bytecode
Python module to generate and modify bytecode
Decision gist · record as of 2026-08-14
Yes, if you need to work with Python bytecode directly. The package is actively maintained, has no security issues, installs cleanly with minimal dependencies, and carries a permissive MIT license. The main constraint is the Python 3.11+ requirement; if you need support for earlier versions, you'll need an older release. The Beta status is not a blocker for most use cases, but verify stability requirements for your specific application.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.11 or newer; earlier versions require different bytecode releases.
- Installation is straightforward with no compiled dependencies.
- The project is actively maintained, with a recent release and ongoing commits.
License · maintenance · safety
permissive license (permissive) — MIT license permits unrestricted use, modification, and distribution with minimal obligations—suitable for both open-source and commercial projects.
last release 2026-06-03 (72 days) · last repo commit 2026-08-04 · 340 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 42,538,846 downloads/mo, #657 on PyPI
Alternatives
Verify before relying
from bytecode import Instr, Bytecode
bytecode = Bytecode([Instr("LOAD_GLOBAL", (True, 'print')),
Instr("LOAD_CONST", 'Hello World!'),
Instr("CALL", 1),
Instr("POP_TOP"),
Instr("LOAD_CONST", None),
Instr("RETURN_VALUE")])
code = bytecode.to_code()
exec(code)- Whether the package handles bytecode differences across Python 3.11, 3.12, 3.13, and 3.14 transparently.
- Performance characteristics when working with large or complex bytecode sequences.
- Stability guarantees given the 'Beta' development status classification.
What it is and what it does
bytecode is a Python library for working with bytecode at the instruction level. It lets you construct executable code objects by assembling individual bytecode instructions (like LOAD_GLOBAL, CALL, RETURN_VALUE), or conversely, disassemble and inspect existing code objects to understand or modify their behavior. This is useful for metaprogramming, code generation, optimization, or dynamic code construction where you need fine-grained control below the AST level.
The library abstracts away the low-level details of Python's bytecode format, which varies across Python versions. It requires Python 3.11 or newer and has only one runtime dependency (typing_extensions). The project is actively maintained and carries no known security vulnerabilities.
Use it for
- Generate executable code dynamically by assembling bytecode instructions without parsing source text.
- Inspect and analyze bytecode of existing functions to understand control flow or optimize hot paths.
- Implement code transformation tools that modify bytecode before execution.
- Build metaprogramming frameworks that need to construct or manipulate code objects programmatically.
- Create bytecode-level testing or instrumentation tools for Python code analysis.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to work with Python bytecode directly.
The package is actively maintained, has no security issues, installs cleanly with minimal dependencies, and carries a permissive MIT license. The main constraint is the Python 3.11+ requirement; if you need support for earlier versions, you'll need an older release. The Beta status is not a blocker for most use cases, but verify stability requirements for your specific application.
Install
bytecode on PyPI
Before you install
Installation is straightforward with no compiled dependencies. The project is actively maintained, with a recent release and ongoing commits. It requires Python 3.11 or newer, and only depends on typing_extensions.
Requires Python 3.11 or newer; earlier versions require different bytecode releases.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal obligations—suitable for both open-source and commercial projects.
Quickstart
from bytecode import Instr, Bytecode
bytecode = Bytecode([Instr("LOAD_GLOBAL", (True, 'print')),
Instr("LOAD_CONST", 'Hello World!'),
Instr("CALL", 1),
Instr("POP_TOP"),
Instr("LOAD_CONST", None),
Instr("RETURN_VALUE")])
code = bytecode.to_code()
exec(code)
Verify before relying
- Whether the package handles bytecode differences across Python 3.11, 3.12, 3.13, and 3.14 transparently.
- Performance characteristics when working with large or complex bytecode sequences.
- Stability guarantees given the 'Beta' development status classification.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.11 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagetyping_extensions |
| Maintenance | Actively maintained 72 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 42,538,846 / month, #657 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: Libraries :: Python Modules |
Evidence: bytecode-0.18.1-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 › “python bytecode generation”
- bytecodebytecode generates and modifies Python bytecode directly, allowing…
- vyperVyper is a Python-like programming language for writing smart…
- keystone-engineKeystone is a lightweight assembler framework that translates…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also xdis · uncompyle6 · pycnite · decompyle3 · executing · ethereum-dasm · pyxbe · pyevmasm · plum-py · pyclean