Skip to main content

Lightweight Python package analytics SDK

Project description

Klyne Python SDK

PyPI version Python Support License: MIT

Lightweight Python package analytics SDK for Klyne. Track package usage, Python version adoption, OS distribution, and more with minimal overhead.

Features

  • =� Lightweight: Zero dependencies, uses only Python standard library
  • Non-blocking: Asynchronous data transmission in background threads
  • = Privacy-first: No PII collection, only aggregated usage metrics
  • =� Robust: Graceful error handling and automatic retries
  • =� Rich insights: Python versions, OS distribution, environment detection
  • <� Simple API: One-line integration with sensible defaults

Installation

pip install klyne

Quick Start 💨

import klyne

# Initialize once in your package
klyne.init(
    api_key="klyne_your_api_key_here",
    project="your-package-name",
    package_version="1.0.0"
)

# That's it! Analytics are automatically collected

What Gets Tracked

The SDK automatically collects:

  • Python Environment: Version, implementation (CPython/PyPy)
  • Operating System: Type, version, architecture
  • Installation Context: pip/conda, virtual environment detection
  • Hardware: CPU count, memory (rounded for privacy)
  • Package Info: Name, version, entry points used

No personally identifiable information is collected.

Advanced Usage

Custom Event Tracking

Track custom events with properties to understand how users interact with your package:

import klyne

# Track user actions
klyne.track('user_login', {
    'user_id': '12345',
    'login_method': 'google'
})

# Track feature usage
klyne.track('feature_used', {
    'feature_name': 'export',
    'file_format': 'csv',
    'rows_exported': 1000
})

# Track errors or issues
klyne.track('error_occurred', {
    'error_type': 'ValidationError',
    'module': 'data_processor'
})

Configuration Options

import klyne

klyne.init(
    api_key="klyne_your_api_key_here",
    project="your-package-name",
    package_version="1.0.0",
    base_url="https://www.klyne.dev",  # Default API URL
    enabled=True,                      # Enable/disable analytics
    debug=False                        # Debug logging
)

Environment-based Control

import os
import klyne

# Disable in development
enabled = os.getenv("ENVIRONMENT") == "production"

klyne.init(
    api_key=os.getenv("KLYNE_API_KEY"),
    project="your-package-name",
    enabled=enabled
)

Manual Control

import klyne

# Disable analytics
klyne.disable()

# Re-enable analytics
klyne.enable()

# Check status
if klyne.is_enabled():
    print("Analytics are active")

# Flush pending events (useful for short-lived scripts)
klyne.flush(timeout=5.0)

Requirements

  • Python 3.7+
  • No external dependencies
  • Internet connection (for sending analytics)

License

MIT License


Get your free API key at klyne.dev

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

klyne-0.2.1a7.tar.gz (34.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

klyne-0.2.1a7-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file klyne-0.2.1a7.tar.gz.

File metadata

  • Download URL: klyne-0.2.1a7.tar.gz
  • Upload date:
  • Size: 34.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for klyne-0.2.1a7.tar.gz
Algorithm Hash digest
SHA256 908ed703dfb76bf11b088d707ff881fd291ec6ebb3c2ffc28fc21590579c2610
MD5 10bb7d4c4fa9c84356789efbd9ff4117
BLAKE2b-256 83b676e0f5dd7b562b195b922487f0c885a9260421106c00e5112061c7ca30b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for klyne-0.2.1a7.tar.gz:

Publisher: publish-sdk.yml on psincraian/klyne

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file klyne-0.2.1a7-py3-none-any.whl.

File metadata

  • Download URL: klyne-0.2.1a7-py3-none-any.whl
  • Upload date:
  • Size: 22.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for klyne-0.2.1a7-py3-none-any.whl
Algorithm Hash digest
SHA256 bd41b1ec4d55995001fbd99f55c083a4ac0a68171d5ff4fa0d04d4b828c719ca
MD5 a686100a97de018b67d9c0b7c37694e2
BLAKE2b-256 55278be2ada0de661610388840345925eb996b51311a5fb79377ed321e4aaadb

See more details on using hashes here.

Provenance

The following attestation bundles were made for klyne-0.2.1a7-py3-none-any.whl:

Publisher: publish-sdk.yml on psincraian/klyne

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page