stack-data
Extract data from python stack frames and tracebacks for informative displays
Decision gist · record as of 2026-08-14
Yes. stack_data is actively maintained, has no known vulnerabilities, and solves a real problem for debugging and REPL tools. Its low install friction and permissive MIT license make it a safe dependency. Install it if you need to display or inspect stack frames with source context; skip it if your use case doesn't involve frame introspection.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires a live frame object; typically called from within executing code or a debugger context.
- Low friction install with three lightweight runtime dependencies (executing, asttokens, pure-eval).
- Actively maintained with recent commits; no known vulnerabilities.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution in both open and proprietary projects.
last release 2023-09-30 (1049 days) · last repo commit 2026-05-17 · 51 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 124,339,009 downloads/mo, #297 on PyPI
Alternatives
Verify before relying
import inspect
import stack_data
frame = inspect.currentframe().f_back
frame_info = stack_data.FrameInfo(frame)
for line in frame_info.lines:
print(f"{line.lineno} | {line.render()}")- Whether the package handles all Python 3.5+ versions listed in classifiers equally well or if some have known limitations.
- Performance characteristics when inspecting very large or deeply nested stack frames.
What it is and what it does
stack_data is a library that extracts structured information from Python stack frames and tracebacks, enabling tools like IPython to display enhanced, context-aware error messages. It parses the source code surrounding the current execution point and organizes it into logical pieces (statements or compound blocks), so that context boundaries are intuitive rather than arbitrary line counts. The library also extracts variable values and expressions from the frame using safe evaluation, allowing debuggers and REPLs to show what data was in scope at the point of failure or inspection.
The core abstraction is FrameInfo, which wraps a frame or traceback object and provides cached attributes like lines (a list of source Line objects with rendering support) and variables (a list of Variable objects with names and values). Options control how much context to include before and after the current line, whether to truncate long pieces, and whether to always show function signatures. The library handles multi-line statements, blank lines, and line gaps transparently, so display code doesn't need to manage those edge cases.
Use it for
- Power enhanced tracebacks in IPython or Jupyter to show more context around exceptions.
- Build a custom debugger that displays variables and surrounding code at breakpoints.
- Inspect stack frames in a REPL to understand local scope and execution flow.
- Generate formatted stack dumps for logging or error reporting with readable source context.
- Extract variable state from a frame for introspection or testing frameworks.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
stack_data is actively maintained, has no known vulnerabilities, and solves a real problem for debugging and REPL tools. Its low install friction and permissive MIT license make it a safe dependency. Install it if you need to display or inspect stack frames with source context; skip it if your use case doesn't involve frame introspection.
Install
stack-data on PyPI
Before you install
Low friction install with three lightweight runtime dependencies (executing, asttokens, pure-eval). Actively maintained with recent commits; no known vulnerabilities.
Requires a live frame object; typically called from within executing code or a debugger context.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open and proprietary projects.
Quickstart
import inspect
import stack_data
frame = inspect.currentframe().f_back
frame_info = stack_data.FrameInfo(frame)
for line in frame_info.lines:
print(f"{line.lineno} | {line.render()}")
Verify before relying
- Whether the package handles all Python 3.5+ versions listed in classifiers equally well or if some have known limitations.
- Performance characteristics when inspecting very large or deeply nested stack frames.
Package facts
| License | MIT permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagesexecutingasttokenspure-eval |
| Maintenance | Actively maintained 1,049 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 124,339,009 / month, #297 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Debuggers |
Evidence: stack_data-0.6.3-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 › “stack frame inspection”
- stack-dataExtracts and displays stack frame and traceback data with…
- traceback-with-variablesAutomatically captures and displays local variables in Python…
- stackprinterReplaces Python's default exception traceback with an enhanced…
Give your agent the search over MCP, or paste the wish link into any chat.
More Debuggers packages
debugpy is a Debug Adapter Protocol implementation for Python that enables remote debugging of Python scripts and modules through standard DAP clients, with support for breakpoints, exception handling, and subprocess debugging.
Install it if you need remote debugging, DAP client integration, or programmatic control over breakpoints and exception handling.
Pylint is a static code analyzer that checks Python code for errors, enforces coding standards, detects code smells, and suggests refactoring improvements without executing the code.
Install it if you need thorough code analysis with inference-based bug detection; if speed is critical, consider pairing it with faster linters like ruff for…
yamllint checks YAML files for syntax errors, style violations, and structural problems like key repetition, line length, trailing spaces, and indentation issues.
ipdb is an IPython-enabled debugger that replaces Python's standard pdb with tab completion, syntax highlighting, and better introspection while maintaining the same pdb interface.
Memray is a memory profiler for Python that traces every function call to track memory allocations across Python code, native extensions, and the interpreter itself, generating reports like flame graphs and tables to analyze memory usage.
pyelftools parses and analyzes ELF binary files and DWARF debugging information in pure Python, with no external dependencies.
Install it if you need to read or analyze ELF binaries or debug information from Python.
See also stackprinter · executing · tracerite · crashtest · tblib · environ · traceback-with-variables · tracebackturbo3 · pytest-markdown-docs · varname