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.17.0.tar.gz (105.9 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.17.0-py3-none-any.whl (43.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for bytecode-0.17.0.tar.gz
Algorithm Hash digest
SHA256 0c37efa5bd158b1b873f530cceea2c645611d55bd2dc2a4758b09f185749b6fd
MD5 73c43999ab078543c8880ea741578bbf
BLAKE2b-256 98c44818b392104bd426171fc2ce9c79c8edb4019ba6505747626d0f7107766c

See more details on using hashes here.

Provenance

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

File metadata

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

File hashes

Hashes for bytecode-0.17.0-py3-none-any.whl
Algorithm Hash digest
SHA256 64fb10cde1db7ef5cc39bd414ecebd54ba3b40e1c4cf8121ca5e72f170916ff8
MD5 127f7e0ad6b251111bd6106bfcaa4000
BLAKE2b-256 ce80379e685099841f8501a19fb58b496512ef432331fed38276c3938ab09d8e

See more details on using hashes here.

Provenance

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

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