Skip to main content

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

Release files for klyne 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for klyne 0.3.0
File Size Uploaded
klyne-0.3.0.tar.gz 15.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for klyne 0.3.0
File Interpreter ABI Platform
klyne-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 28.5 kB

Release files / klyne-0.3.0.tar.gz

Download URL klyne-0.3.0.tar.gz
Size 15.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2c09affb3fad7806a2f14005fbdaf239b0e18122da9c0c144630b9c58ec47bc7
BLAKE2b-256 checksum
How to use checksums
1e8ab2b0b52cf4ec4267a5ea0ce8b08475d5c8debde46b6cf95200d93935009e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2025.

Transparency log

Release files / klyne-0.3.0-py3-none-any.whl

Download URL klyne-0.3.0-py3-none-any.whl
Size 13.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
86dd402d0bca54a592645e5541df45e16c976ff265efff245c32b6da36afe431
BLAKE2b-256 checksum
How to use checksums
64c8f2c726c2e7532fc5b48c6ffac2aa27044401ecfd64b90a17e04b1c24d351
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2025.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page