snoop
Powerful debugging tools for Python
What it is and what it does
snoop is a Python debugging library that replaces manual print-statement debugging with a single decorator or context manager. Instead of scattering print calls throughout your code to track execution flow and variable changes, you annotate the function or wrap a code block with @snoop or with snoop:, and snoop logs every line that runs, the order in which they execute, and the exact moment each local variable changes value. It also includes pp, a pretty-print utility that shows both the source expression and its formatted value, useful for quick inline inspection.
The package is designed for developers who want visibility into function behavior without the setup overhead of a graphical debugger. It supports watching arbitrary expressions, exploding nested data structures to see all attributes and items, and tracing into nested function calls via the depth parameter. snoop integrates with IPython and Jupyter, and can be globally installed via install() to avoid explicit imports in your code.
Use it for:
- Trace execution flow and variable mutations in a function without adding print statements or opening a debugger.
- Inspect the values and timing of changes to complex nested data structures during a function call.
- Debug a memoizing or caching decorator by watching when cache lookups succeed or fail across multiple calls.
- Print intermediate values of subexpressions inline without restructuring your code, using pp() or pp.deep().
- Understand call sequences and state changes across multiple nested function calls using the depth parameter.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
snoop adds decorator-based and context-manager tracing to Python functions, logging which lines execute, when variables change, and their values—a lightweight alternative to setting up a full debugger.
Yes. snoop is actively maintained, has no known vulnerabilities, installs with minimal friction, and solves a real friction point in Python debugging. If you regularly reach for print-based debugging or want a faster alternative to setting up a breakpoint debugger, it's a low-risk, high-utility addition. The MIT license and broad Python version support (3.8–3.14) make it suitable for most projects.
Install
snoop on PyPI
pip
pip install snoopuv
uv add snooppoetry
poetry add snoopInstalling snoop
Before you install
Low friction: pure Python wheel with four lightweight runtime dependencies (cheap_repr, executing, asttokens, pygments). Active maintenance—last commit 2026-07-18, 1459 repository stars—and supports Python 3.8 through 3.14.
License in practice
MIT license (permissive): you can use, modify, and distribute snoop freely in both open-source and proprietary projects with minimal restrictions.
Quickstart
pip install snoop
import snoop
@snoop
def example(x):
y = x + 1
return y * 2
example(5)
Verify before relying
- Whether pp.deep's lambda-based subexpression tracing works reliably in all IDE/notebook environments
- Performance overhead when tracing deeply nested call stacks (depth parameter behavior under load)
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — cheap_repr, executing, asttokens, pygments |
| Maintenance | actively maintained — 27 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 266,004/month — #8,312 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: snoop-0.6.1-py3-none-any.whl
Tags
More Debuggers packages
Extracts and displays stack frame and traceback…
permissive · top 1,000 on PyPI
debugpydebugpy is a Debug Adapter Protocol…
permissive · top 1,000 on PyPI
pylintPylint is a static code analyzer that checks…
copyleft · top 1,000 on PyPI
yamllintyamllint checks YAML files for syntax errors,…
copyleft · top 1,000 on PyPI
ipdbipdb is an IPython-enabled debugger that…
permissive · top 5,000 on PyPI
memrayMemray is a memory profiler for Python that…
permissive · top 5,000 on PyPI
icecreamIceCream provides a drop-in replacement for…
permissive · top 5,000 on PyPI
PySnooperPySnooper is a decorator-based debugging tool…
permissive · top 15,000 on PyPI
seeq-spySeeq-spy is a Python interface for interacting…
unclear · top 15,000 on PyPI
kgbkgb intercepts and records function calls in…
permissive · top 5,000 on PyPI
traceback-with-variablesAutomatically captures and displays local…
permissive · top 15,000 on PyPI
AutologgingAutologging provides decorators to…
permissive · top 15,000 on PyPI
pytest-mockProvides a pytest fixture that wraps the mock…
permissive · top 1,000 on PyPI
varnameRetrieves variable names at runtime from inside…
permissive · top 15,000 on PyPI
undecoratedStrips decorators from Python functions,…
permissive · top 15,000 on PyPI
memory-profilerProfiles memory consumption line-by-line in…
permissive · top 5,000 on PyPI