Skip to main content

Python module to generate and modify bytecode

Project description

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bytecode-0.18.1.tar.gz (104.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bytecode-0.18.1-py3-none-any.whl (42.9 kB view details)

Uploaded Python 3

File details

Details for the file bytecode-0.18.1.tar.gz.

File metadata

  • Download URL: bytecode-0.18.1.tar.gz
  • Upload date:
  • Size: 104.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bytecode-0.18.1.tar.gz
Algorithm Hash digest
SHA256 d9564f1565fe1ae6a1173e544ef43a85f093e83997ef45af65d0d250eb48d7a1
MD5 76e96beb53a4a5544260b04b3040c9c2
BLAKE2b-256 278f7d12c539869a5cbd801d550b86cc0f030ecaeb12f57f8b3ff19f2d2a184c

See more details on using hashes here.

Provenance

The following attestation bundles were made for bytecode-0.18.1.tar.gz:

Publisher: release.yml on MatthieuDartiailh/bytecode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bytecode-0.18.1-py3-none-any.whl.

File metadata

  • Download URL: bytecode-0.18.1-py3-none-any.whl
  • Upload date:
  • Size: 42.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bytecode-0.18.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9535bfdd665260b2888ec4121569e3ca5106965a7fedbb6de6ba1bafebc5c7d7
MD5 fe5713e1a0cf6bec6683a1cc8d874968
BLAKE2b-256 d9ef6a629424ec08adc3819ddfd7ec0a710361eaa29d1e5fffb4e02f074be5c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for bytecode-0.18.1-py3-none-any.whl:

Publisher: release.yml on MatthieuDartiailh/bytecode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page