Our take
- Activity
- 19
- Community
- 58
- Issues
- 21
- Pull requests
- 20
-2 stars in the last 30 days
Project history
Daily GitHub snapshots since Oct 7, 2026. History covers stars and forks; health signals are not tracked historically.
Stars
16,576Forks
971Change since Nov 14, 2026: +2 stars·0 forks
Overview
PySnooper is a Python debugging library that records execution details for selected code. Add a decorator to a function or use a context manager around a block to see which lines ran, when they ran, and when local variables changed.
It is useful when print statements are cumbersome and setting up a full debugger is more effort than the investigation warrants. The trace can go to standard error, a file, a stream, or a callable, making it practical in codebases where debugger setup is inconvenient.
Key Features
- Trace a function by adding the
@pysnooper.snoop()decorator. - Trace only a specific block with a
with pysnooper.snoop():context manager. - Record executed lines, timestamps, and changes to local variables.
- Send trace output to standard error or specify a file, stream, or callable.
- Watch expressions beyond local variables, such as object attributes and indexed values.
- Increase trace depth to include functions called by the traced function.
Use Cases
- A Python developer investigating unexpected function output can quickly inspect execution and local state without placing print statements throughout the code.
- A maintainer working in a large codebase can trace a narrow function or block when configuring a full debugger is impractical.
- A developer debugging code whose standard error is hard to access can direct the trace to a log file or another supported output target.
- A developer checking how nested calls affect a result can increase trace depth to include called functions.
Getting Started
Install with pip:
pip install pysnooper
See the README for usage examples and links to advanced options.
Alternatives
- pudb: PuDB provides an interactive terminal debugger with breakpoints and stepping, while PySnooper logs execution and local-variable changes automatically.
| Project | Language | License | Stars | Status |
|---|---|---|---|---|
| PySnooper | Python | MIT | 16.6k | Not checked yet |
| pudb | Python | – | 3.3k | Active |
Considerations
PySnooper provides execution traces, not the breakpoints and watch interface of a full-fledged debugger. Tracing can produce detailed logs, so use it on the code you need to inspect and choose an appropriate output destination. The repository is MIT licensed; see the README for installation options and advanced usage.
Found this useful?
Share it with someone who would like PySnooper.