Skip to main content

CLI tool to compile Python packages into Binmod modules

Project description

py2binmod

Compile Python projects to Binmod WebAssembly modules.

Overview

py2binmod transpiles Python code that uses the Binmod Python MDK into Rust, bundles a Python interpreter (RustPython), and compiles everything to WebAssembly. This allows you to write plugins in Python and run them in any Binmod runtime.

Trade-offs: Larger module sizes and slower startup times compared to native Rust modules, but enables using Python code in the Binmod ecosystem.

Installation

Option 1: Docker (Recommended)

No local dependencies required:

docker run -ti -v "$(pwd)":/app ghcr.io/binmod-io/py2binmod:0.1.0 build

Option 2: Install via pip

Requires Rust toolchain:

pip install py2binmod

Prerequisites for pip installation:

  • Install Rust from rustup.rs
  • Add the WebAssembly WASI Preview 1 target:
    rustup target add wasm32-wasip1
    

Usage

Build Command

Compile your Python module to WebAssembly:

With Docker:

docker run -ti -v "$(pwd)":/app ghcr.io/binmod-io/py2binmod:0.1.0 build [--release]

With pip:

py2binmod build [--release]

Your compiled WebAssembly module will be at:

artifacts/wasm32-wasip1/[debug|release]/<project_name>.wasm

Custom Output Directory

py2binmod build --out-dir ./custom_output

Transpile Command

Generate Rust code without compiling:

py2binmod transpile [--out-dir ./rust_output]

Without --out-dir, prints to stdout. Useful for debugging.

How It Works

py2binmod:

  1. Parses your Python project that uses the Binmod Python MDK
  2. Generates a Rust wrapper using the Binmod Rust MDK
  3. Bundles RustPython (a Python interpreter written in Rust)
  4. Compiles everything to WebAssembly with the wasm32-wasip1 target

Your Python code runs in the bundled interpreter, wrapped in a Rust layer that handles the Binmod protocol.

License

MIT License

Support

If you encounter issues or have questions, please open an issue on GitHub.

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

py2binmod-0.1.1.tar.gz (48.5 kB view details)

Uploaded Source

Built Distributions

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

py2binmod-0.1.1-cp310-abi3-win_amd64.whl (3.5 MB view details)

Uploaded CPython 3.10+Windows x86-64

py2binmod-0.1.1-cp310-abi3-win32.whl (3.2 MB view details)

Uploaded CPython 3.10+Windows x86

py2binmod-0.1.1-cp310-abi3-musllinux_1_2_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ x86-64

py2binmod-0.1.1-cp310-abi3-musllinux_1_2_i686.whl (4.2 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ i686

py2binmod-0.1.1-cp310-abi3-musllinux_1_2_armv7l.whl (4.0 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARMv7l

py2binmod-0.1.1-cp310-abi3-musllinux_1_2_aarch64.whl (3.9 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

py2binmod-0.1.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

py2binmod-0.1.1-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (3.8 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ s390x

py2binmod-0.1.1-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (4.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ppc64le

py2binmod-0.1.1-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (4.1 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ i686

py2binmod-0.1.1-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (3.7 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARMv7l

py2binmod-0.1.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.8 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

py2binmod-0.1.1-cp310-abi3-macosx_11_0_arm64.whl (3.5 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

py2binmod-0.1.1-cp310-abi3-macosx_10_12_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file py2binmod-0.1.1.tar.gz.

File metadata

  • Download URL: py2binmod-0.1.1.tar.gz
  • Upload date:
  • Size: 48.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.10.2

File hashes

Hashes for py2binmod-0.1.1.tar.gz
Algorithm Hash digest
SHA256 988dfb3ef647fd5acaa8c62d520b660c45b74ee207bf778b9d992c4ea0f79181
MD5 0c788eb34f00831e81d91ea89838d609
BLAKE2b-256 ea6bca3b119138157cfc4f8b554abbc7d1c396251d4b7f2e323d6a62441a256b

See more details on using hashes here.

File details

Details for the file py2binmod-0.1.1-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for py2binmod-0.1.1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 08ede66ef170ed76adb69726213e9890b2b7d0670e24402550c8828bf0a76880
MD5 ce2b4624b54c293b23ac060798aad5ab
BLAKE2b-256 409ff1c7ce6bd1e7315a17d2dd96b3f77a1b4ae92353a8b6dc1f250b6204040d

See more details on using hashes here.

File details

Details for the file py2binmod-0.1.1-cp310-abi3-win32.whl.

File metadata

  • Download URL: py2binmod-0.1.1-cp310-abi3-win32.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: CPython 3.10+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.10.2

File hashes

Hashes for py2binmod-0.1.1-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 344cd88047e442e2c85266f708bd84282f9fef57b1541e1959c773bd0ae78e5a
MD5 f828cf22f3611703e040d2f74a0ad504
BLAKE2b-256 50a39c9a9402936f9160f6d45339221496358db96b2ee7eb6a3ac73822135218

See more details on using hashes here.

File details

Details for the file py2binmod-0.1.1-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for py2binmod-0.1.1-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 043165a9b4c61e97133628652aca45caca217f9ccc275eec890767ca0fdb400e
MD5 3c2cd093a986042dc37f76ad0b279452
BLAKE2b-256 16aea0e8a67e87e877dbf675d1d37713936f420f27d619d7b8fddd9e2eab4459

See more details on using hashes here.

File details

Details for the file py2binmod-0.1.1-cp310-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for py2binmod-0.1.1-cp310-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 6957c47de64dc8b2b4e3c3bf7d66153d41d48944a8abe2073b2dec8735777bdd
MD5 0af75bfd1ce66c8b0c3f6ea189e964d9
BLAKE2b-256 e62fe13a909d7e96c9f745764e83b08ca0c8bb7e701754f77ffc966745197dea

See more details on using hashes here.

File details

Details for the file py2binmod-0.1.1-cp310-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for py2binmod-0.1.1-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 368ac23eb0e3b9aeb0ee4ad46d63a52f57667d5f45551502d3c35c29bddc9d43
MD5 1bccc6db63b244e5315098cc8d43c621
BLAKE2b-256 483a0d709ba025ff25ae22e6f45d0fde7fa0859f43b4555485eb31f58340bb1c

See more details on using hashes here.

File details

Details for the file py2binmod-0.1.1-cp310-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for py2binmod-0.1.1-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 5ccdbc8e484e9cd67b448d0f76f2cf3a6674ff0036e272dc61a14536bf51d21a
MD5 5fab087525daee230d71fbef8ae8a7d1
BLAKE2b-256 050a5cea8d082ff9369fc54d4ceb109369f331770e797dd79c0c760f03baabf1

See more details on using hashes here.

File details

Details for the file py2binmod-0.1.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for py2binmod-0.1.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0dd1382fbfa35dfe643c37f45e6946112797cf063fe4628fae3ade2a3b5f9a49
MD5 c51c335ae0b6d911d69c51106c3a1930
BLAKE2b-256 debe8e05ff82c3405e22fb101b71ec67309175e8a54ee31956e9c06210e32bd1

See more details on using hashes here.

File details

Details for the file py2binmod-0.1.1-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for py2binmod-0.1.1-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 2be08a73b0f6ed82136adca3d5395b1eef5fd9e14799bc23a389c3add88159ae
MD5 36d9df8af9d219cea802dd05d6476707
BLAKE2b-256 7e4ea3bcc0a83a668912e4c3c31bc91794ca8dee76c646a8aa3b255d1524c8ba

See more details on using hashes here.

File details

Details for the file py2binmod-0.1.1-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for py2binmod-0.1.1-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 157b301d68975ec03ef2b9b1b052ddd70b20dafb143a2efc8ca8f7e0941fbf08
MD5 b91e311c9503749aee59d922796f14f8
BLAKE2b-256 d013579c2cc651205b2ca36644a4d246e9bbc8c40e2b2bbfcd4cac784a54d89c

See more details on using hashes here.

File details

Details for the file py2binmod-0.1.1-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for py2binmod-0.1.1-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 5f46d63ba9e8365395b3c46aab889260faf48acd55231fc465ba47feb9afd1dc
MD5 7f1a6ffdb0bbe3a954b8446714d772dd
BLAKE2b-256 674e6061f745ab3742032845f529d86aa21c250b8a7604869e3b7b6f9bc02f6a

See more details on using hashes here.

File details

Details for the file py2binmod-0.1.1-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for py2binmod-0.1.1-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 2a09df97788e17c0be627b7a85dc37770ec327693232b9f90bcab05b467d8ce9
MD5 5b20c5c86c3c6e3e746f4a7cfad8e90e
BLAKE2b-256 8b4a67762fb292d4f3343ea99e97105225b0064616ac8ee4e8bce65c489f0bd4

See more details on using hashes here.

File details

Details for the file py2binmod-0.1.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for py2binmod-0.1.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 01dbc49469341d87f9313d314b28be95e49ed0d359e77b7fa02aef088ae5f8e1
MD5 b50dcb35a7044f18d2d80b12354c19a4
BLAKE2b-256 8244b84d6a3fb0134840d72679b1fe4eadc56495a08d2c469ef9fa5adb53056d

See more details on using hashes here.

File details

Details for the file py2binmod-0.1.1-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for py2binmod-0.1.1-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a73cfb75b1f234384274979e1db9b1a27f8721cccb060124edfb8acdee949524
MD5 3e590ec049d87b14ade6ba1169035b1a
BLAKE2b-256 ae4437b681700ade608e5114d310aa9844947b02cd1e4f6de506c6fe2b7036be

See more details on using hashes here.

File details

Details for the file py2binmod-0.1.1-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for py2binmod-0.1.1-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 cf4b2f15e6f76f3b7aba2b814d1efe0e70e4f906597c641c8787de9107a99f56
MD5 c9c47c68a6f438dd0ee472196442280a
BLAKE2b-256 9a88c422004e8a8923929a567e2cb9dea6b30cc922455c56be5c29268e4137a7

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