Skip to main content

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

Metadata

Release files for scarf-sdk 0.2.1

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

Source distribution (sdist)

Source distribution for scarf-sdk 0.2.1
File Size Uploaded
scarf_sdk-0.2.1.tar.gz 11.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for scarf-sdk 0.2.1
File Interpreter ABI Platform
scarf_sdk-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 19.9 kB

Release files / scarf_sdk-0.2.1.tar.gz

Download URL scarf_sdk-0.2.1.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bac1c41b274659dd6a1653cb61dddb0c222677548f5e6ce2b22baa70a643eb13
BLAKE2b-256 checksum
How to use checksums
ab56434f4171cffcab2d463dbb2bda20905f748a06a8fde7239e72f4fca89e02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / scarf_sdk-0.2.1-py3-none-any.whl

Download URL scarf_sdk-0.2.1-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eaaec3182ea4faceab3a1e0b260318c3f1e432273be03810e09aa807d0939431
BLAKE2b-256 checksum
How to use checksums
12df1e58161731f1be1bf97122296677862290ee0955392f7e71a4c476f0bf9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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