Introduction
What TraceKit is, why it exists, and how it fits into your Python projects.
TraceKit is a minimal, zero-dependency observability SDK for Python 3.12+. It gives you error tracking and performance timing using only the Python standard library.
What TraceKit does
When an app fails or slows down, you need two things: what crashed and how long each step took. TraceKit captures both without adding external services or heavy frameworks.
- Error tracking: Automatically catches unhandled exceptions in your main thread, worker threads, and
asyncioloops, or lets you report handled errors withtracekit.capture_exception(). - Performance timing: Times functions with
@tracekit.traceand arbitrary code blocks withwith tracekit.span(...):. - Context & breadcrumbs: Attaches user details, tags, and up to 20 breadcrumbs per thread or async task using
contextvars. - Three output modes: Prints colorized lines to
stderr(console), appends JSONL files (file:events.jsonl), or batches HTTP POST requests to a local viewer (http://127.0.0.1:8765/ingest).
Design principles
- Zero runtime dependencies: Only Python 3.12+ standard library modules are used.
- Non-blocking delivery: Events are queued (up to 1,000 items) and processed by a single background daemon thread.
- Never crash your app: SDK errors are caught internally. User exceptions always propagate unchanged.
Next steps
Head to Installation to add TraceKit to your environment, or jump straight to the Quick Start.