explaingit

cool-rr/pysnooper

16,586Python

TLDR

PySnooper is a lightweight debugging tool for Python that eliminates the need to scatter print statements throughout your code.

Mindmap

A visual breakdown will appear here once this repo is fully enriched.

In plain English

PySnooper is a lightweight debugging tool for Python that eliminates the need to scatter print statements throughout your code. The idea is simple: instead of manually writing print lines to track what your code is doing, you add a single decorator line above any function and PySnooper automatically logs every line that runs, every variable that changes, and the exact moment each change happens. It is described as a poor man's debugger, you do not need to set up a full debugging environment, configure breakpoints, or do any special preparation. You just add the decorator and run your code as normal. The output shows a timestamped, line-by-line trace of what happened inside the function, including new variables being created and their values changing over time. If you do not want to trace an entire function, you can wrap just a specific block of code inside a with statement instead. By default the trace output goes to stderr, but you can redirect it to a log file by passing a file path to the decorator. You can also tell it to watch specific expressions that are not local variables, and you can ask it to trace not just your function but also the functions your function calls, by setting a depth option. PySnooper is installed via pip and is also available through conda and in package managers for Arch Linux and Fedora. It is open source under the MIT license and has been cited in academic work.

Open on GitHub → Explain another repo

Generated 2026-05-21 · Model: sonnet-4-6 · Verify against the repo before relying on details.