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 Code formatted using Black

bytecode is a Python module to generate and modify bytecode.

Install bytecode: python3 -m pip install bytecode. It requires Python 3.5 or newer.

Example executing print('Hello World!'):

from bytecode import Instr, Bytecode

bytecode = Bytecode([Instr("LOAD_NAME", 'print'),
                     Instr("LOAD_CONST", 'Hello World!'),
                     Instr("CALL_FUNCTION", 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.12.0.tar.gz (66.2 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.12.0-py3-none-any.whl (51.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bytecode-0.12.0.tar.gz
  • Upload date:
  • Size: 66.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2.post20210112 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for bytecode-0.12.0.tar.gz
Algorithm Hash digest
SHA256 a9549d79b276cb91f6fb8008bf563863a202757e36482ee411bd87622d5bb1bf
MD5 48997a9a0b93fd1358e593f49cbfba64
BLAKE2b-256 1cae1f5854553b21c0dacb22d6572d56d84eeb4a3dacd1e18efd5841b2e98792

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bytecode-0.12.0-py3-none-any.whl
  • Upload date:
  • Size: 51.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2.post20210112 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for bytecode-0.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 40659445900e11cb1f5f09b0e35fe0af2f04661691ca8dc0b505f7bd3d8b8959
MD5 c3dfe981a0ea0d234194cb88828ee1b4
BLAKE2b-256 77187d994c036581b4dac6c9612d75dd120565a55806d57fa9842ccde8fa03cc

See more details on using hashes here.

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