Skip to main content

Python bindings for Scarf telemetry

Project description

scarf-py

PyPI - Version

A Python client for sending telemetry events to Scarf using JSON payloads.

Installation

pip install scarf-sdk

Usage

from scarf import ScarfEventLogger

# Initialize with required endpoint URL
logger = ScarfEventLogger(
    endpoint_url="https://your-scarf-endpoint.com",
    timeout=5.0  # Optional: Set default timeout in seconds (default: 3.0)
)

# Send an event with properties
success = logger.log_event({
    "event": "package_download",
    "package": "scarf",
    "details": {
        "version": "1.0.0",
        "platforms": ["linux", "macos"]
    }
})

# Send an event with a custom timeout
success = logger.log_event(
    properties={"event": "custom_event"},
    timeout=1.0  # Override default timeout for this call
)

# Empty properties are allowed
success = logger.log_event({})

Configuration

The client can be configured through environment variables:

  • DO_NOT_TRACK=1: Disable analytics
  • SCARF_NO_ANALYTICS=1: Disable analytics (alternative)
  • SCARF_VERBOSE=1: Enable verbose logging

Features

  • Simple API for sending telemetry events
  • JSON payloads (supports nested data)
  • Environment variable configuration
  • Configurable timeouts (default: 3 seconds)
  • Respects user Do Not Track settings
  • Verbose logging mode for debugging

Development

  1. Clone the repository
  2. Install development dependencies:
    pip install -e ".[dev]"
    
  3. Run tests:
    pytest
    

Publishing

To publish a new version:

  1. Update version in setup.py and pyproject.toml
  2. Create and push a new tag:
    git tag v0.1.0
    git push origin v0.1.0
    

The CI workflow will automatically build and publish to PyPI when a new version tag is pushed.

License

Apache 2.0

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

scarf_sdk-0.2.0.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

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

scarf_sdk-0.2.0-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file scarf_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: scarf_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for scarf_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 81d2119f52a45b6af0b3664a4d938be8cdb11ab79dc0fef5ff88c267a57d9394
MD5 a94febc7ece1e68d4049451b7e409219
BLAKE2b-256 71f13448cb39a9f9126c3d00e64717f28639d63d5d5381805636adb0fd87070f

See more details on using hashes here.

File details

Details for the file scarf_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: scarf_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for scarf_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c72a61e5a5b62d2ed2267af5c1d03e93e53d900917cfbe8059233da22bdc54d2
MD5 36d03f7e4776f9942da30032f91d73dc
BLAKE2b-256 577305054c55888667de0eddd5a3fa74440f2efc3bba65516b434c25ff2ef235

See more details on using hashes here.

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