Python module to generate and modify bytecode
Project Links
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
bytecode is a Python module to generate and modify bytecode.
bytecode project homepage at GitHub (code, bugs)
Download latest bytecode release at the Python Cheeseshop (PyPI)
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)
0.19.0
Aug 21, 2026
0.18.1
Jun 03, 2026
0.18.0
Jun 03, 2026
0.17.0
Sep 03, 2025
0.16.2
Apr 14, 2025
0.16.1
Jan 21, 2025
0.16.0
Oct 28, 2024
0.15.1
Oct 13, 2023
0.15.0
Sep 01, 2023
0.14.2
May 24, 2023
0.14.1
Apr 04, 2023
0.14.0
Nov 30, 2022
0.13.0
Oct 04, 2021
0.12.0
Feb 02, 2021
0.11.0
Mar 02, 2020
0.10.0
Feb 02, 2020
0.9.0
Dec 01, 2019
0.8.0
Feb 18, 2019
0.7.0
Apr 19, 2018
0.6.0
Apr 19, 2018
0.5
Jan 05, 2017
0.4
Apr 12, 2016
0.3
Mar 02, 2016
0.2
Feb 29, 2016
0.1
Feb 26, 2016
0.0
Feb 23, 2016
Wheel compatibility matrix
Files in release
Extras:
None
Dependencies:
typing_extensions