bytecode 0.19.0


pip install bytecode

  Latest version

Released: Aug 21, 2026


Meta
Author: Victor Stinner
Maintainer: Matthieu C. Dartiailh
Requires Python: >=3.11

Classifiers

Development Status
  • 4 - Beta

Intended Audience
  • Developers

License
  • OSI Approved :: MIT License

Natural Language
  • English

Operating System
  • OS Independent

Programming Language
  • Python :: 3
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13
  • Python :: 3.14

Topic
  • Software Development :: Libraries :: Python Modules
Latest release on the Python Cheeseshop (PyPI) Continuous integration Documentation building Code coverage of bytecode on codecov.io Ruff

bytecode is a Python module to generate and modify bytecode.

Install bytecode: python3 -m pip install bytecode. It requires Python 3.8 or newer. The latest release that supports Python 3.7 and 3.6 is 0.13.0. The latest release that supports Python 3.5 is 0.12.0. For Python 2.7 support, have a look at dead-bytecode instead.

Example executing print('Hello World!'):

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)

Wheel compatibility matrix

Platform Python 3
any

Files in release

Extras: None
Dependencies:
typing_extensions