skillfed

snoop

Powerful debugging tools for Python

snoop v0.6.1 266.0K downloads/30d#8,312 on PyPI1,459
Permissive license MIT Active released

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 snoop

uv

uv add snoop

poetry

poetry add snoop

Installing 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

Environment :: ConsoleLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development :: Debuggers

Tags

function execution tracingdebug logging decoratorvariable change trackingprint debugging helperline-by-line execution logpython debugging toolsfunction call inspection
debuggingintrospectiondevelopment-tools

More Debuggers packages