Skip to main content

Python bindings for Scarf telemetry

Project description

scarf-py

A Python client for sending telemetry events to Scarf.

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",
    "version": "1.0.0"
})

# 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
  • 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.1.2.tar.gz (11.3 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.1.2-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scarf_sdk-0.1.2.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.11

File hashes

Hashes for scarf_sdk-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d79e157b440a488da1fed47b8917fdbc794120ca8306e994062f8c7e787ac163
MD5 98a822b2231cb9f63e8b9df81a44548b
BLAKE2b-256 1a022614a523d72c2b84f7ca24f7fb25128f81f2ae07d5de623ec6d31c277ec6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: scarf_sdk-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.11

File hashes

Hashes for scarf_sdk-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d3768ecb9e484965f6956a05c982c52b77cdcd576284107dbeed715f5dffba36
MD5 8b48825f7ba54c988dae4806a1f7cbc8
BLAKE2b-256 57334120ac6960a390c7c24cee2c09852557fe42718b12c59f0e781fb0eec762

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