executing
Get the currently executing AST node of a frame, and other information
Decision gist · record as of 2026-08-14
Yes. This is a mature, actively maintained, zero-dependency library with permissive licensing and no known vulnerabilities. It fills a specific and well-defined niche—mapping bytecode back to AST—that is difficult to solve correctly and is already trusted by widely-used projects (IPython, Sentry SDK, icecream). Install it if you need frame introspection or are building debugging/monitoring tools.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.8 or later; node identification may return None if the bytecode pattern cannot be reliably matched.
- Low friction—pure Python with no runtime dependencies and a wheel distribution.
- Actively maintained with recent releases; last commit on 2026-08-12 and a release on 2025-09-01.
License · maintenance · safety
MIT (permissive) — MIT license (permissive) places no restrictions on use, modification, or distribution in proprietary or open-source projects.
last release 2025-09-01 (347 days) · last repo commit 2026-08-12 · 400 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 141,816,500 downloads/mo, #275 on PyPI
Alternatives
Verify before relying
import executing
frame = ... # obtain a frame object
node = executing.Source.executing(frame).node
if node:
print(type(node).__name__) # e.g., 'Call', 'Attribute'- Whether the package's reliability claims (one-to-one bytecode-to-node mapping) hold across all Python 3.8–3.14 versions listed in classifiers.
- Performance characteristics when called repeatedly on large or deeply nested call stacks.
What it is and what it does
executing is a lightweight introspection library that maps Python bytecode instructions back to their corresponding AST nodes. Given a frame object (or traceback), it determines which specific expression or statement is currently executing—for example, whether a line is calling a function, accessing an attribute, or performing a binary operation—and returns the AST node representing that operation.
The package works by comparing bytecode generated from candidate AST nodes against the actual bytecode in the frame, using a technique of modifying the AST and observing bytecode changes to identify the exact match. It supports Call, Attribute, Subscript, BinOp, UnaryOp, and Compare nodes. The library has no runtime dependencies and is designed for use in debugging tools, stack introspection libraries, and print-debugging utilities that need to know what code is executing at a given moment.
Use it for
- Build enhanced tracebacks that highlight the exact operation causing an exception, as used by IPython and friendly_traceback.
- Implement print-debugging tools (like icecream or snoop) that show which arguments are being passed to a function call.
- Create real-time execution visualizers that track which operations are running in each stack frame.
- Enable dark-magic libraries (like sorcery or varname) to determine where special callables are invoked from.
- Add function __qualname__ context to error reporting in production monitoring (e.g., Sentry SDK integration).
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
This is a mature, actively maintained, zero-dependency library with permissive licensing and no known vulnerabilities. It fills a specific and well-defined niche—mapping bytecode back to AST—that is difficult to solve correctly and is already trusted by widely-used projects (IPython, Sentry SDK, icecream). Install it if you need frame introspection or are building debugging/monitoring tools.
Install
executing on PyPI
Before you install
Low friction—pure Python with no runtime dependencies and a wheel distribution. Actively maintained with recent releases; last commit on 2026-08-12 and a release on 2025-09-01.
Requires Python 3.8 or later; node identification may return None if the bytecode pattern cannot be reliably matched.
License in practice
MIT license (permissive) places no restrictions on use, modification, or distribution in proprietary or open-source projects.
Quickstart
import executing
frame = ... # obtain a frame object
node = executing.Source.executing(frame).node
if node:
print(type(node).__name__) # e.g., 'Call', 'Attribute'
Verify before relying
- Whether the package's reliability claims (one-to-one bytecode-to-node mapping) hold across all Python 3.8–3.14 versions listed in classifiers.
- Performance characteristics when called repeatedly on large or deeply nested call stacks.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 347 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 141,816,500 / month, #275 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 LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9 |
Evidence: executing-2.2.1-py2.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 › “ast node from frame”
- executingIdentifies the AST node currently being executed in a Python frame,…
- openpulseOpenPulse parses and represents pulse grammar for quantum computing…
- asttokensAnnotates Python abstract syntax trees with the positions of tokens…
Give your agent the search over MCP, or paste the wish link into any chat.
Similar packages
Safely evaluate Python AST nodes without executing arbitrary code or triggering side effects, useful for inspecting expressions in source code.
Development is aging but the repo remains maintained; use it when safety and side-effect avoidance are requirements, not for general expression evaluation.
Retrieves the name of a variable or attribute as a string at runtime through AST inspection, mimicking C# nameof functionality.
Extracts and displays stack frame and traceback data with context-aware source code rendering, used to power enhanced tracebacks in IPython and similar tools.
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.
bytecode generates and modifies Python bytecode directly, allowing you to construct executable code objects from low-level instruction sequences or inspect and transform existing bytecode.
Retrieves variable names at runtime from inside functions and classes, and provides utilities to fetch argument names and detect attribute access patterns.
Install it if you need runtime variable name introspection; skip it if your code does not require that capability.
Annotates Python abstract syntax trees with the positions of tokens and source code text, enabling tools to map AST nodes back to their originating code for refactoring, analysis, and transformation.
See also ast-comments · beniget · trailmark · icecream