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.0.tar.gz (48.2 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.0-cp310-abi3-win_amd64.whl (3.5 MB view details)

Uploaded CPython 3.10+Windows x86-64

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

Uploaded CPython 3.10+Windows x86

py2binmod-0.1.0-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.0-cp310-abi3-musllinux_1_2_i686.whl (4.2 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ i686

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

Uploaded CPython 3.10+musllinux: musl 1.2+ ARMv7l

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

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

py2binmod-0.1.0-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.0-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.0-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.0-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.0-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.0-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.0-cp310-abi3-macosx_11_0_arm64.whl (3.5 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

py2binmod-0.1.0-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.0.tar.gz.

File metadata

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

File hashes

Hashes for py2binmod-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cb9f5b3f0b17cd8b5c4e6ed702eb696e6c384ade73a9b3be9746c485ef0d2bfa
MD5 8c90caee989c2b5d15aee1aa1933d1c6
BLAKE2b-256 3d08a593fcdf63a2ae58fb1684377cf73c1b1ad228c95609acb83124e29893a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py2binmod-0.1.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 52e86bf2142859e5ddb9e02aaab818ecc8723a58e76fad6fc75b31baa431461d
MD5 6ccb56da23c0780fbbc50d9de5374bc4
BLAKE2b-256 9773ebcbf9acad4c176e2cb52147efd11224541b8257f41bf66a350203298797

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py2binmod-0.1.0-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.0-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 af176581c24fd07cea5c7a83dc7d3a349246f3502ef8bbf690762f51f6d6b5ae
MD5 8a9ab95cf4694cb85a5ffb04914f11c7
BLAKE2b-256 97519e6495ac502944b516c7786a0f650ddbde06f1f8a4b89c95fd84d4a73203

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py2binmod-0.1.0-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 6c926f3591254af1299f6454fc6d9917b9a246548ba0cd62a1ddc1554153a21a
MD5 919d7781700768c8320f97a9e02646b8
BLAKE2b-256 796fdf0525c60b6f6b3352236f53bd0c464075d4d48d54975f6e0070b3f2e10f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py2binmod-0.1.0-cp310-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 d85133a32d453c4060263a7b2c759e2598a82fbffb2cf73c760e1032538b5ddd
MD5 ef54dc70832ca43e9f7b18aad8fc84cd
BLAKE2b-256 948743716e2ce19820e9dc5e3ec6269513cbf46353f0e3fd7e600e538f1d5a12

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py2binmod-0.1.0-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 723854bb0481248f84bf744694df75233a0e9ce07248f747fdd8dc780f7c3396
MD5 a333f57c6d1241c357f3972a5fb47d7f
BLAKE2b-256 d1500b004b8a2625941f4906959b86270223a308bb54baf0ad74f02bcd8e5e1b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py2binmod-0.1.0-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 3cd98c67d28429a7ea1b7b8c3dbce3ba36106711c70237b0f3c90847f60662e5
MD5 43e18015ab2b6fd65d31f012072fe76b
BLAKE2b-256 8421ec95e816ab84a0b93be1b9aa33f251c64d521fc74550f2bdbde707a11e31

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py2binmod-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cd403be471f837d229393e3d961a6a10c0815d7626ec8b06a0d900556291ba7b
MD5 57d3df191f15a11d7d5d9752c05f59f0
BLAKE2b-256 66b50e826a2f8aedfef3efa455685a3b2e10a74cc0b0f3fe52c42a21df453058

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py2binmod-0.1.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 e3dd008a014411c1eb1b149b7044240a31cf02fb5018676b7318acdd8a4ee048
MD5 e05717f3e3a692eff232174c20a8c4e7
BLAKE2b-256 44685ce159222d1c5ac278b0ed00c413f01a01e4c0380f39d565e29de0b4e85c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py2binmod-0.1.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 9feab7274ef47996b4b8f3388ebcdc242f76219668ef117f42a6ad07a556eea5
MD5 c0c7dc604f01f2ff6e576a6e512c00c9
BLAKE2b-256 453523395a34541945deb9794dd4321f0c570627b51dce304b1ce4d0f10c687d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py2binmod-0.1.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 10c067823b84aa39407b50484f6ebec34da13efdfe6dbed4ebf2ea4c71f6fa30
MD5 6311e165dc338f45d0d2c1e68105aa6c
BLAKE2b-256 aae621daa1f057c78838f007599e1925fc689c676251ad7642f69c5c712f7589

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py2binmod-0.1.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 bab9b7f55240f4d11e6354e9ac34f6481c4207eda2b3dcb2a62cf0866cf4cb60
MD5 f28756a7e6e07b6fe318ab1aeb4d923f
BLAKE2b-256 73031319426135f5953fc41df47224efeffc609bf6aee0a48cc29d74b5ef7ec6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py2binmod-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1db6915ff0934904abfbbe9514dfd8e2bf13fd650b7c7bdef93f42806878f76f
MD5 4fb204862be2962964631bb914a5e307
BLAKE2b-256 c382f32db731beb345ad7d4da3cbfc43bab698a0a731a9555c5e3e2150a31243

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py2binmod-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cdddca91b9ecf8a50286e79762754ba73f619dbdfb6a5a4cad5711550a7b806f
MD5 ae530a97b1e2a5d8ff50744ebb6f8883
BLAKE2b-256 58f4fa96eafbd6ed93fd4b477edc916e64b4915eb7e2ea96bdfb8b3dc466b2b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py2binmod-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a102ff1a0607df5276c0d58de705e4df124e9d424ebf90bbf95c54e0360f04a8
MD5 2a98cfa39bb50edf24c85d07e1b37f1f
BLAKE2b-256 8d0cb3d3b7e8bebb73446b5ac76f5d513bb032ca9979b436f9c3afcbcfcf0a07

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