A Python client for sending telemetry events to Scarf.
pip install scarf-sdk
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({})
The client can be configured through environment variables:
DO_NOT_TRACK=1
: Disable analyticsSCARF_NO_ANALYTICS=1
: Disable analytics (alternative)SCARF_VERBOSE=1
: Enable verbose logging
- 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
- Clone the repository
- Install development dependencies:
pip install -e ".[dev]"
- Run tests:
pytest
To publish a new version:
- Update version in
setup.py
andpyproject.toml
- 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.
Apache 2.0