hunter
Hunter is a flexible code tracing toolkit.
What it is and what it does
Hunter is a code tracing toolkit that uses Python's sys.settrace hook to intercept and log execution events—function calls, line executions, returns, and exceptions—with flexible filtering and customizable output actions. It is not a coverage tool but a debugging and inspection instrument, useful for understanding code flow, tracking variable state, and diagnosing runtime behavior.
You configure it by passing filters (module name, function name, conditions) and actions (CallPrinter, CodePrinter, VarsPrinter, or custom handlers) to the trace() function. It supports terminal output with optional colors, can be activated via environment variables, and includes a CLI tool to attach to running processes. The package depends on manhole for process attachment capability.
Use it for:
- Debug a function by tracing all calls within a specific module and printing their arguments and return values.
- Inspect variable state at each line of execution to understand how values change through a code path.
- Attach to a running process to trace execution without stopping or restarting it.
- Log all calls to a third-party library to understand its internal behavior and call sequence.
- Drop into a debugger (pdb) conditionally when a specific function or condition is encountered during execution.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Hunter is a code tracing toolkit that intercepts and logs function calls, line executions, and variable changes for debugging and inspection without measuring coverage.
Yes, if you need flexible runtime code tracing for debugging or inspection. Hunter is stable (Production/Stable status), has no known vulnerabilities, and low install friction. The aging maintenance (357 days since last release) is a minor concern but the repository is active and supports current Python versions. Install it when you need to trace execution flow, inspect variables, or understand third-party code behavior without coverage measurement.
Install
hunter on PyPI
pip
pip install hunteruv
uv add hunterpoetry
poetry add hunterInstalling hunter
Before you install
Low friction installation with a single pure-Python runtime dependency (manhole). Last release was 357 days ago; repository is active and not archived, though maintenance status is aging.
License in practice
BSD-2-Clause is permissive and poses no restrictions on commercial or private use, modification, or redistribution.
Quickstart
pip install hunter
import hunter
hunter.trace(module='os.path', action=hunter.CallPrinter)
import os
os.path.join('a', 'b')
Requires Python 3.9 or later. For process attachment via CLI, the manhole dependency must be installed (included automatically).
Verify before relying
- Whether the aging maintenance status (357 days since release) affects compatibility with the latest Python versions (3.13 is listed as supported).
- Performance overhead of tracing in production environments compared to other tracing solutions.
Package facts
| License | BSD-2-Clause (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — manhole |
| Maintenance | aging — 357 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,078,499/month — #4,402 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: hunter-3.9.0-pp39.pp310.pp311.graalpy311-none-any.whl
Keywords: trace, tracer, settrace, debugger, debugging, code, source
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
logfuryLogfury adds automatic method-call tracing to…
permissive · top 15,000 on PyPI
pybacklogpyPyBacklogPy wraps the Backlog API to let you…
permissive · top 5,000 on PyPI
viztracerVizTracer traces Python code execution and…
permissive · top 5,000 on PyPI
jaeger-clientJaeger-client instruments Python applications…
permissive · top 15,000 on PyPI
AutologgingAutologging provides decorators to…
permissive · top 15,000 on PyPI
weaveWeave is a toolkit for tracing, logging, and…
permissive · top 5,000 on PyPI
mozdebugProvides utilities for launching and managing…
copyleft · top 15,000 on PyPI
lauterbach-trace32-rclProvides a Python interface to Lauterbach…
permissive · top 15,000 on PyPI
pydevdpydevd is a Python debugger backend that…
copyleft · top 5,000 on PyPI
PySnooperPySnooper is a decorator-based debugging tool…
permissive · top 15,000 on PyPI