{"library":"pysnooper","title":"PySnooper","description":"PySnooper is a Python debugging tool often described as a 'poor man's debugger'. It allows developers to trace the execution of their code by automatically logging variable values, function calls, and execution lines to stdout or a file, without requiring traditional breakpoints or extensive manual print statements. The current stable version is 1.2.3. Recent GitHub activity indicates ongoing maintenance, including support for newer Python versions.","language":"python","status":"active","last_verified":"Sat May 16","install":{"commands":["pip install pysnooper"],"cli":{"name":"pysnooper","version":"sh: 1: pysnooper: not found"}},"imports":["import pysnooper\n\n@pysnooper.snoop()\ndef my_function():\n    pass"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import pysnooper\nimport os\n\n# To demonstrate file output, create a dummy log file path\nlog_file_path = os.path.join(os.getcwd(), 'pysnooper_output.log')\n\n@pysnooper.snoop(output=log_file_path, color=False)\ndef number_to_bits(number):\n    if number == 0:\n        return [0]\n    bits = []\n    while number:\n        number, remainder = divmod(number, 2)\n        bits.insert(0, remainder)\n    return bits\n\nresult = number_to_bits(6)\nprint(f\"Result for 6: {result}\")\n\n# You can also use it as a context manager for a block of code\ndef main_logic():\n    a = 10\n    b = 20\n    with pysnooper.snoop(output=log_file_path, color=False):\n        temp = a + b\n        final = temp * 2\n    print(f\"Final value in main_logic: {final}\")\n\nmain_logic()\n\n# Cleanup (optional, for a runnable example)\n# import os\n# if os.path.exists(log_file_path):\n#     os.remove(log_file_path)\n","lang":"python","description":"The primary way to use PySnooper is by applying the `@pysnooper.snoop()` decorator to a function you wish to inspect. This will log a detailed trace of execution, including variable changes and lines run. You can redirect output to a file and disable colored output for better readability in text editors. Alternatively, `pysnooper.snoop()` can be used as a context manager for specific code blocks.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-16","installed_version":"1.2.3","pypi_latest":"1.2.3","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":1.5,"avg_import_s":0.04,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pysnooper","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.02,"mem_mb":1.4,"disk_size":"17.9M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pysnooper","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.5,"import_time_s":0.02,"mem_mb":1.4,"disk_size":"18M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pysnooper","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.05,"mem_mb":1.7,"disk_size":"19.7M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pysnooper","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.6,"import_time_s":0.04,"mem_mb":1.7,"disk_size":"20M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pysnooper","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.05,"mem_mb":1.5,"disk_size":"11.6M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pysnooper","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.5,"import_time_s":0.05,"mem_mb":1.5,"disk_size":"12M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pysnooper","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.06,"mem_mb":2.3,"disk_size":"11.3M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pysnooper","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.4,"import_time_s":0.07,"mem_mb":2.1,"disk_size":"12M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pysnooper","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.02,"mem_mb":1.5,"disk_size":"17.4M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pysnooper","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.7,"import_time_s":0.02,"mem_mb":1.5,"disk_size":"18M"}]}}