Skip to main content

No project description provided

Project description

Handit Core (Python)

Lightweight function and HTTP tracing for Python applications with zero configuration. Captures function calls/returns with arguments and return values, and outgoing HTTP requests/responses (including bodies) for requests and httpx. Events are buffered in-memory and written once at process exit to handit_events.jsonl.

Install

Build from source (requires Rust and Python toolchain):

python -m pip install maturin
python -m maturin develop --release -m python/pyproject.toml

Quick start

from handit import session, tracing
import requests

@tracing(agent="demo")
def fetch_user(user_id: int) -> dict:
    resp = requests.get(f"https://httpbin.org/anything/{user_id}")
    return resp.json()

if __name__ == "__main__":
    with session(tag="demo-session"):
        fetch_user(42)
# Events will be written to ./handit_events.jsonl at exit

What is captured

  • Function events: call/return/exception
    • Arguments preview on call
    • Return value preview on return
  • HTTP events (client-side)
    • requests/httpx: method, URL, headers, request body; response status, headers, body, size, duration, error
    • aiohttp: method, URL, headers; response status, headers (bodies are not captured by default)

Behavior

  • Zero-config: HTTP instrumentation is enabled on import; no environment variables are required.
  • Noise reduction: internal library frames and stdlib/site-packages are excluded by default.
  • Output: events are buffered and flushed once at exit to handit_events.jsonl.
    • Override path via env HANDIT_OUTPUT_FILE=./path/file.jsonl.

Advanced

  • Manual flush during runtime:
from handit_core import handit_core_native as native
native.flush_events_to_file("./handit_events.jsonl")
  • Optional envs (all have safe defaults):
    • HANDIT_INCLUDE / HANDIT_EXCLUDE: module/function regex filters
    • HANDIT_MAX_STR (default 256), HANDIT_MAX_LOCALS (default 64)
    • HANDIT_REDACT: regex for keys to redact in previews
    • HANDIT_CAPTURE_ONLY_CWD (default true)

Notes

  • Capturing full HTTP bodies may include sensitive data. Ensure you comply with your data policy.
  • For aiohttp streamed bodies, body capture can be added with explicit buffering middleware if needed.

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

handit_ai-0.0.5.tar.gz (27.2 kB view details)

Uploaded Source

Built Distribution

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

handit_ai-0.0.5-cp310-cp310-macosx_11_0_arm64.whl (2.5 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file handit_ai-0.0.5.tar.gz.

File metadata

  • Download URL: handit_ai-0.0.5.tar.gz
  • Upload date:
  • Size: 27.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for handit_ai-0.0.5.tar.gz
Algorithm Hash digest
SHA256 c6459511918e224ea2f08d77953496260532b7a0d4a4eba858dbf101a05cbd3e
MD5 a50059534c03f9b651980c3a8e600143
BLAKE2b-256 d0b1faa51ee3bdae32b5df3ac1025fd23f5ae72cd3e9714cb6ac768e8ea7b2ca

See more details on using hashes here.

File details

Details for the file handit_ai-0.0.5-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for handit_ai-0.0.5-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 233efb246086146cd1d02f42737f567f2b68ee8b19e17a97d3fade19d49e7b18
MD5 fe83bf839a835f9c444f3f2e0ff05b3c
BLAKE2b-256 ef0311b76bdd784dd25c290db08ed4879f0aea386a96a9229e56eca04d916e8a

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