Hunter is a flexible code tracing toolkit for debugging, logging, and inspection, not for code coverage. It offers a simple Python API, a convenient terminal API, and a CLI tool. The library is currently at version 3.9.0 and is actively maintained with a regular release cadence.
pip install hunterVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to activate Hunter to trace calls within the 'os.path' module using the `CallPrinter` action, both explicitly and via a context manager for localized tracing. Remember to call `hunter.stop()` when tracing is no longer needed to avoid overhead.
Explicitly specify `action=hunter.CallPrinter` or `action=hunter.CodePrinter` for desired output behavior.
Use the Python `~` operator with a `hunter.Q` object for negation (e.g., `hunter.trace(~hunter.Q(module='my_module'))`).
Ensure you can reproduce the scenario while Hunter is actively tracing, or integrate it into your test suite for automated tracing during execution.
Filter by `module` with operators, or implement a custom filter function (a callable that receives an `Event` object) for more specific tracing needs.
Upgrade to Python 3.9 or higher (as per current `requires_python`) or use an older `hunter` version compatible with Python 2.x (e.g., `<3.4.0`).
Install the library using pip: `pip install hunter`
Ensure that arguments passed to `hunter.trace()` that are meant to be actions or filters are callable objects. For instance, use `hunter.actions.CallPrinter()` instead of a string like `'CallPrinter'`, or pass a function reference instead of its name as a string.
Verify the spelling of `trace` and ensure you are importing the `hunter` library correctly. The standard usage is `import hunter` followed by `hunter.trace(...)`. If you intend to import `trace` directly, use `from hunter import trace`.
No dependency data recorded yet.