--- id: hunter version: "3.9.0" license: BSD-2-Clause license_treatment: permissive maintenance: aging --- # hunter — Hunter is a flexible code tracing toolkit. License: permissive · Maintenance: aging · Downloads: 1.1M/mo ## 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 above — 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 pip install hunter uv add hunter poetry add hunter ## Installing 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_current - Install friction: low - Maintenance: aging - Downloads: 1.1M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags code tracing debugger, function call tracer, python execution tracer, line-by-line code inspection, settrace wrapper, debugging toolkit, variable inspection tracer, debugging, tracing, inspection [View on SkillFed](https://skillfed.io/packages/hunter) · [View on PyPI](https://pypi.org/project/hunter/)