skillfed

PySnooper

A poor man's debugger for Python.

pysnooper v1.2.3 525.9K downloads/30d#6,182 on PyPI16,579
Permissive license Active released

What it is and what it does

PySnooper is a lightweight debugging decorator that replaces ad-hoc print statements with structured execution logging. When you decorate a function with @pysnooper.snoop(), it automatically logs every line executed, the order in which they run, and the exact moment each local variable changes. The output goes to stderr by default but can be redirected to a file or custom stream.

It's designed for situations where setting up a full debugger feels like overkill—you just want to see what your code is actually doing. You can trace entire functions or wrap specific code blocks in a context manager. It supports watching arbitrary expressions beyond just local variables and can follow execution into called functions via a depth parameter.

Use it for:

  • Trace execution flow through a complex function to understand control flow without a debugger.
  • Log variable state changes during development to catch unexpected mutations or initialization bugs.
  • Debug legacy or enterprise code where attaching a debugger is impractical or slow.
  • Inspect function behavior in production-like environments by redirecting output to a log file.
  • Watch specific expressions like object attributes or dictionary keys during execution.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

PySnooper is a decorator-based debugging tool that logs function execution line-by-line, showing which lines run and how local variables change, without requiring debugger setup.

Yes. PySnooper is a zero-friction, actively maintained tool with no dependencies and a permissive license. It solves a real debugging workflow gap—faster than print debugging, simpler than a full debugger setup. Install it if you debug Python code interactively.

Install

pysnooper on PyPI

pip

pip install pysnooper

uv

uv add pysnooper

poetry

poetry add pysnooper

Installing PySnooper

Before you install

Low friction: pure Python wheel with no runtime dependencies. Actively maintained with recent commits.

License in practice

MIT license permits unrestricted use, modification, and distribution in both open and closed projects.

Quickstart

pip install pysnooper

import pysnooper

@pysnooper.snoop()
def my_function():
    x = 1
    y = x + 2
    return y

my_function()

Verify before relying

  • Actual repository star count and download volume to assess community adoption and reliability.

Package facts

License not declared (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 440 days since the last release
Last repo commit
First released
Downloads 525,918/month — #6,182 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: PySnooper-1.2.3-py2.py3-none-any.whl

Environment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 2.7Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Debuggers

Tags

function execution tracingline-by-line debuggingvariable change loggingdecorator-based debuggerexecution flow visualizationdebug without breakpointsfunction call inspection
debuggingdevelopment-toolslogging

More Debuggers packages