Skip to main content

Universal error tracking SDK for Python

Project description

ez-pixel

Universal error tracking SDK for Python. Part of the ezcoder ecosystem.

Install

pip install ez-pixel

Quick Start

Automatic setup (recommended)

ezcoder pixel install

This detects your Python project, installs ez-pixel, wires the init file into your entry point, and generates a project key.

Manual setup

import ez_pixel

ez_pixel.init_pixel(
    project_key="pk_live_abc123",
    ingest_url="https://your-pixel-server.workers.dev/ingest",
)

That's it — unhandled exceptions are now tracked automatically.

API

init_pixel(project_key, ingest_url, *, runtime=None)

Initialize the SDK. Registers sys.excepthook, threading.excepthook, and atexit handlers.

report_pixel(message, error=None, level="error")

Manually report an error.

try:
    risky_operation()
except Exception as e:
    ez_pixel.report_pixel("Risky operation failed", error=e, level="warning")

flush_pixel()

Drain the internal event queue (blocking). Call before process exit in short-lived scripts.

close_pixel()

Flush + tear down all hooks and deactivate the SDK.

Features

  • Zero dependencies — uses only the Python standard library
  • Thread-safe — events are queued and drained in a background thread
  • Exponential backoff — retries failed deliveries (0.2s → 0.4s → 0.8s → 1.6s → 3.2s)
  • Code context — captures source lines around the error
  • Fingerprinting — groups duplicate errors with SHA-256 fingerprints
  • Python 3.8+ — works on older Python versions

Wire Format

Events are posted as JSON to the ingest endpoint:

{
  "event_id": "uuid4",
  "project_key": "pk_live_abc123",
  "fingerprint": "sha256(type + top frame)[:16]",
  "type": "ValueError",
  "message": "something went wrong",
  "stack": [{"file": "main.py", "line": 42, "col": 0, "fn": "run", "in_app": true}],
  "code_context": {"file": "main.py", "error_line": 42, "lines": ["..."]},
  "runtime": "python-3.12.3",
  "manual_report": false,
  "level": "error",
  "occurred_at": "2026-04-29T14:22:01Z"
}

License

MIT

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

ez_pixel-0.1.0.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

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

ez_pixel-0.1.0-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file ez_pixel-0.1.0.tar.gz.

File metadata

  • Download URL: ez_pixel-0.1.0.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for ez_pixel-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9a07baaac4f70233d1ea45774e68130d9f08f8943cfc3f3e1ea0ad6706c620fa
MD5 4b27ba919a1308c38771090eb7e27bcd
BLAKE2b-256 9a7c8674a7271675adf0eef3dc50d7ae1cfd51b93880e66b686bc7e7db5fda2f

See more details on using hashes here.

File details

Details for the file ez_pixel-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ez_pixel-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for ez_pixel-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 622ee566418426f8336d6078b39167235dd4ab0fb7df8adf91338b46fd352444
MD5 670ae110722a2c37e42eeda84f3956b2
BLAKE2b-256 eaea7f1447473af987da5087b30a7922acdc1c655174ceec273ec439e7363569

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