# PySnooper: Never use print for debugging again

- Speaker: [Ram Rachum](/wiki/speakers/ram-rachum.md)
- Event: [Reversim Summit 2022](/wiki/years/2022.md)
- Video: https://www.youtube.com/watch?v=oqAEPbi_bCc
- Transcript: [/transcripts/2022/26-oqAEPbi_bCc.md](/transcripts/2022/26-oqAEPbi_bCc.md)
- Language: Hebrew · Type: talk · Level: intermediate
- Topics: [Open Source](/wiki/topics/open-source.md), [Debugging](/wiki/topics/debugging.md), [Developer Experience](/wiki/topics/developer-experience.md), [Productivity](/wiki/topics/productivity.md)

> Written by an LLM from machine transcripts. It can contain errors. Check the transcript before you quote it.

## Summary

The speaker shares their journey of creating an open-source debugging tool for Python called PySnooper and how it unexpectedly went viral. The talk compares traditional debuggers with the common practice of using print statements, highlighting the trade-offs in setup complexity and utility. The speaker explains how the tool bridges this gap by providing automatic function tracing with a simple decorator. Additionally, the talk explores the psychological and practical aspects of maintaining a popular open-source project, including dealing with community contributions and forks. The audience learns about balancing feature scope, writing effective documentation, and embracing the open-source ethos.

## Key points

- [2:21](https://www.youtube.com/watch?v=oqAEPbi_bCc&t=141s) The speaker introduces the project, explaining its purpose as a debugging helper and mentioning its unexpected viral success on GitHub and Reddit.
- [3:33](https://www.youtube.com/watch?v=oqAEPbi_bCc&t=213s) The speaker demonstrates the use of a traditional debugger, emphasizing its power for stepping through code and inspecting variables.
- [5:40](https://www.youtube.com/watch?v=oqAEPbi_bCc&t=340s) Many developers avoid traditional debuggers because remote setup and configuration in containerized environments are overly complex.
- [8:18](https://www.youtube.com/watch?v=oqAEPbi_bCc&t=498s) While print statement debugging is primitive and requires manual repetition, its universal availability makes it the default fallback for many developers.
- [10:30](https://www.youtube.com/watch?v=oqAEPbi_bCc&t=630s) The speaker introduces PySnooper as a middle-ground solution that uses a simple function decorator to automatically log execution steps.
- [14:41](https://www.youtube.com/watch?v=oqAEPbi_bCc&t=881s) Under the hood, the tool leverages Python's built-in sys.setrace function to trace execution line by line.
- [15:44](https://www.youtube.com/watch?v=oqAEPbi_bCc&t=944s) Writing clear documentation and a concise canonical code example in the README is crucial for the adoption of open-source projects.
- [22:08](https://www.youtube.com/watch?v=oqAEPbi_bCc&t=1328s) When a prominent contributor creates a fork to add heavier features, it provides alternative options for users and validates different maintenance philosophies.

## Takeaways

- Prioritize a simple, frictionless setup and clear documentation to help your open-source project gain traction.
- Choose tools that fit your maintenance philosophy, keeping codebases minimalist if long-term simplicity is the goal.
- Accept that community feedback and project forks are a natural and healthy part of the open-source ecosystem.

## Questions this talk answers

- How can I trace function execution in Python without setting up a complex remote debugger?
- What are the best practices for writing a README that drives adoption for an open-source project?
- How should a maintainer handle feature creep and forks in an open-source project?

## Technologies

Python, Django, PyPy, VS Code

## Tags

community, debugging, developer tools, open source, python
