stackprinter
Debug-friendly stack traces, with variable values and semantic highlighting
Decision gist · record as of 2026-08-14
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.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction—pure Python wheel with no runtime dependencies.
- Actively maintained with recent commits and a solid user base.
License · maintenance · safety
permissive license (permissive) — MIT license permits unrestricted use, modification, and distribution in both open and closed projects.
last release 2026-04-17 (119 days) · last repo commit 2026-04-17 · 1,299 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 444,664 downloads/mo, #6,621 on PyPI
Alternatives
Verify before relying
pip install stackprinter
import stackprinter
stackprinter.set_excepthook(style='darkbg2')
# or in an except block:
try:
risky_call()
except:
stackprinter.show()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 on this page. Verify before relying on it.
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
stackprinter on PyPI
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 | permissive license permissive |
| Python support | Supports the current Python release >=3.4 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 119 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 444,664 / month, #6,621 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3 |
Evidence: stackprinter-0.2.13-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “better python tracebacks”
- stackprinterReplaces Python's default exception traceback with an enhanced…
- better-exceptionsFormats Python exceptions with syntax highlighting and local variable…
- colored-tracebackAutomatically colors Python exception tracebacks in the terminal to…
Give your agent the search over MCP, or paste the wish link into any chat.
More Quality Assurance packages
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
Ruff is a Python linter and code formatter written in Rust that combines linting, formatting, and code fixing into a single tool, replacing Flake8, Black, isort, and related utilities.
Pexpect spawns and controls interactive console applications by sending input and matching output patterns, automating tasks that would otherwise require manual interaction.
Black reformats Python source code to a consistent style by parsing entire files and rewriting them according to an opinionated, deterministic set of rules, eliminating manual formatting decisions.
pytest-xdist distributes pytest tests across multiple CPU cores or machines to speed up test execution, with the simplest usage being `pytest -n auto` to spawn workers equal to available CPUs.
Install it if your test suite takes long enough that parallelization would save meaningful time.
Validates AWS CloudFormation templates in YAML or JSON format against resource provider schemas and best practices, checking property values and configuration correctness.
Install it if you work with CloudFormation templates.
See also devtools · stack-data · tracerite · colored-traceback · crashtest · tracebackturbo3 · tblib · pretty-errors · exceptiongroup · cli-exit-tools