--- id: stackprinter version: "0.2.13" license: unclear license_treatment: permissive maintenance: active --- # stackprinter — Debug-friendly stack traces, with variable values and semantic highlighting License: permissive · Maintenance: active · Downloads: 444.7K/mo ## What it is and what it does stackprinter is a Python debugging utility that intercepts exceptions and prints them with significantly more context than the standard traceback. Instead of showing only the line that failed, it displays surrounding source code, the values of all variables visible at each frame, and how each function was called—answering the questions you'd normally ask an interactive debugger without requiring one. It works in three modes: as a global exception hook (replacing the default crash message), called selectively in except blocks, or integrated with Python's logging module. Output is plain text by default (suitable for log files) but supports color modes for terminal use. Configuration options let you control verbosity, hide sensitive variables, truncate large values, and suppress output from specific code paths. Use it for: - Debugging production errors where only log files are available, not an interactive debugger. - Logging exceptions with full context in long-running services or batch jobs. - Replacing the default REPL crash message with more informative output via sitecustomize.py. - Inspecting the current call stack and variable state at any point in code, not just on exception. - Examining another thread's stack during concurrent debugging. - Integrating enhanced tracebacks into a custom logging formatter for structured error reporting. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Replaces Python's default exception traceback with an enhanced version that shows surrounding code context and the values of nearby variables at each stack frame. Yes. Zero dependencies, permissive license, active maintenance, and no known vulnerabilities. Install it if you spend time debugging Python code or need better error context in production logs—it's a low-risk, high-value addition to any Python project. ## Install pip install stackprinter uv add stackprinter poetry add stackprinter ## Installing stackprinter Before you install: Low friction—pure Python wheel with no runtime dependencies. Actively maintained with recent commits and a solid user base. License in practice: MIT license permits unrestricted use, modification, and distribution in both open and closed projects. Quickstart: pip install stackprinter import stackprinter stackprinter.set_excepthook(style='darkbg2') # or in an except block: try: risky_call() except: stackprinter.show() ## Package facts - License: not declared (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 444.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags better python tracebacks, exception debugging with variables, enhanced stack traces, python crash output formatting, debug traceback with context, variable inspection in exceptions, readable error messages, debugging, error-handling, logging [View on SkillFed](https://skillfed.io/packages/stackprinter) · [View on PyPI](https://pypi.org/project/stackprinter/)