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.0.tar.gz (103.3 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.0-py3-none-any.whl (42.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bytecode-0.18.0.tar.gz
  • Upload date:
  • Size: 103.3 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.0.tar.gz
Algorithm Hash digest
SHA256 f877c35f6e5dc5b7b59b47b9d522f6c28c3aa733d45b437854f8e262480465be
MD5 1b810e4c467195164bf948e60cf313fc
BLAKE2b-256 6ddeaa2480bfc4c154ca5b2c693da3b14ae950187a53795feaf289e3799a820f

See more details on using hashes here.

Provenance

The following attestation bundles were made for bytecode-0.18.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: bytecode-0.18.0-py3-none-any.whl
  • Upload date:
  • Size: 42.7 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0033ac16efccc7849a669d7a9b67f5a3db04af2da6fb7470c062f6380d116536
MD5 8f3a79f4ee77b8545b7a987a98bf2751
BLAKE2b-256 51826f611b5b0036a5f2209f7a8242c3edc73ff7dbbf500f994f53281cf2935f

See more details on using hashes here.

Provenance

The following attestation bundles were made for bytecode-0.18.0-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