Skip to main content

saythanks Latest Version

Python interface to the Binaryen library

This module provides a Python interface to the binaryen webassembly library.

That library has to be installed separately, make sure it is available on your system as a shared library. You may need to add something to your link library search path to let python pick it up.

Requires Python 3.6 or newer. Also works on pypy3 (because it uses cffi).

Software license: MIT

Example

Running the following code:

import binaryen

module = binaryen.ModuleCreate()
params = binaryen.TypeCreate([binaryen.TypeInt32(), binaryen.TypeInt32()], 2)
results = binaryen.TypeInt32()
x = binaryen.LocalGet(module, 0, binaryen.TypeInt32())
y = binaryen.LocalGet(module, 1, binaryen.TypeInt32())
add = binaryen.Binary(module, binaryen.AddInt32(), x, y)
adder = binaryen.AddFunction(module, b"adder", params, results, binaryen.ffi.NULL, 0, add)
binaryen.ModulePrint(module)
binaryen.ModuleDispose(module)

results in the following Webasm Text output:

(module
 (type $i32_i32_=>_i32 (func (param i32 i32) (result i32)))
 (func $adder (; 0 ;) (param $0 i32) (param $1 i32) (result i32)
  (i32.add
   (local.get $0)
   (local.get $1)
  )
 )
)

Release files for pybinaryen 1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pybinaryen 1.6
File Size Uploaded
pybinaryen-1.6.tar.gz 14.4 kB Details

Release files / pybinaryen-1.6.tar.gz

Download URL pybinaryen-1.6.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ebbdb923d41e00ed15be5c045437d46c54c68bd67f1451b071ead3a55aedbe2a
BLAKE2b-256 checksum
How to use checksums
d95cdc1812198c6fed65af973d1d31f056b121d8fb5b6114ff3d2381c529e8c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Release history Release notifications | RSS feed

1.124

2 release files

1.123

1 release file

1.122

1 release file

1.120

2 release files

1.116

1 release file

1.112

1 release file

1.13

1 release file

1.11

1 release file

1.10

1 release file

1.9

1 release file

1.7

1 release file

This release

1.6 This release

1 release file

1.5

1 release file

1.4

1 release file

1.3

1 release file

1.2

1 release file

1.1

1 release file

1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page