# <img height="48" src="https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/logo.png" alt="Wasmer logo" valign="middle"> Wasmer Python, the Cranelift compiler [![PyPI version](https://img.shields.io/pypi/v/wasmer_compiler_cranelift)](https://pypi.org/project/wasmer_compiler_cranelift/) [![Wasmer Python Documentation](https://img.shields.io/badge/docs-read-green)](https://wasmerio.github.io/wasmer-python/api/wasmer_compiler_cranelift/) [![Wasmer PyPI downloads](https://pepy.tech/badge/wasmer_compiler_cranelift)](https://pypi.org/project/wasmer_compiler_cranelift/) [![Wasmer Slack Channel](https://img.shields.io/static/v1?label=chat&message=on%20Slack&color=green)](https://slack.wasmer.io)
`wasmer` is a complete and mature WebAssembly runtime for
Python. `wasmer_compiler_cranelift` provides the Cranelift compiler to
`wasmer`, so that `wasmer` is able to compile WebAssembly module.
Other compilers exist:
* `wasmer_compiler_llvm`,
* `wasmer_compiler_singlepass`.
To get a more complete view, please see the documentation of [the
`wasmer` package itself](https://github.com/wasmerio/wasmer-python).
# Install
This package must be used with the `wasmer` package, thus:
```sh
$ pip install wasmer
$ pip install wasmer_compiler_cranelift
```
# Usage
Any engines in `wasmer.engine` can take the
`wasmer_compiler_cranelift.Compiler` class as argument:
```py
from wasmer import engine, Store, Module, Instance
from wasmer_compiler_cranelift import Compiler
# Let's use the Cranelift compiler with the JIT engine…
store = Store(engine.JIT(Compiler))
# … or with the native engine!
store = Store(engine.Native(Compiler))
# And now, compile the module.
module = Module(store, open('my_program.wasm', 'rb').read())
# Now it's compiled, let's instantiate it.
instance = Instance(module)
# And get fun, for example by calling the `sum` exported function!
print(instance.exports.sum(1, 2))
```
# Documentation
Browse the documentation at
https://wasmerio.github.io/wasmer-python/api/wasmer_compiler_cranelift/.
Alternatively, run `just build compiler-cranelift` followed by `just
doc` to generate the documentation inside
`docs/api/wasmer_compiler_cranelift.html`.
Raw data
{
"_id": null,
"home_page": "",
"name": "wasmer-compiler-cranelift",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "python,extension,webassembly",
"author": "Wasmer Engineering Team <engineering@wasmer.io>",
"author_email": "Wasmer Engineering Team <engineering@wasmer.io>",
"download_url": "",
"platform": "",
"description": "# <img height=\"48\" src=\"https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/logo.png\" alt=\"Wasmer logo\" valign=\"middle\"> Wasmer Python, the Cranelift compiler [![PyPI version](https://img.shields.io/pypi/v/wasmer_compiler_cranelift)](https://pypi.org/project/wasmer_compiler_cranelift/) [![Wasmer Python Documentation](https://img.shields.io/badge/docs-read-green)](https://wasmerio.github.io/wasmer-python/api/wasmer_compiler_cranelift/) [![Wasmer PyPI downloads](https://pepy.tech/badge/wasmer_compiler_cranelift)](https://pypi.org/project/wasmer_compiler_cranelift/) [![Wasmer Slack Channel](https://img.shields.io/static/v1?label=chat&message=on%20Slack&color=green)](https://slack.wasmer.io)\n\n`wasmer` is a complete and mature WebAssembly runtime for\nPython. `wasmer_compiler_cranelift` provides the Cranelift compiler to\n`wasmer`, so that `wasmer` is able to compile WebAssembly module.\n\nOther compilers exist:\n\n* `wasmer_compiler_llvm`,\n* `wasmer_compiler_singlepass`.\n\nTo get a more complete view, please see the documentation of [the\n`wasmer` package itself](https://github.com/wasmerio/wasmer-python).\n\n# Install\n\nThis package must be used with the `wasmer` package, thus:\n\n```sh\n$ pip install wasmer\n$ pip install wasmer_compiler_cranelift\n```\n\n# Usage\n\nAny engines in `wasmer.engine` can take the\n`wasmer_compiler_cranelift.Compiler` class as argument:\n\n```py\nfrom wasmer import engine, Store, Module, Instance\nfrom wasmer_compiler_cranelift import Compiler\n\n# Let's use the Cranelift compiler with the JIT engine\u2026\nstore = Store(engine.JIT(Compiler))\n\n# \u2026 or with the native engine!\nstore = Store(engine.Native(Compiler))\n\n# And now, compile the module.\nmodule = Module(store, open('my_program.wasm', 'rb').read())\n\n# Now it's compiled, let's instantiate it.\ninstance = Instance(module)\n\n# And get fun, for example by calling the `sum` exported function!\nprint(instance.exports.sum(1, 2))\n```\n\n# Documentation\n\nBrowse the documentation at\nhttps://wasmerio.github.io/wasmer-python/api/wasmer_compiler_cranelift/.\n\nAlternatively, run `just build compiler-cranelift` followed by `just\ndoc` to generate the documentation inside\n`docs/api/wasmer_compiler_cranelift.html`.\n\n",
"bugtrack_url": null,
"license": "",
"summary": "The Cranelift compiler for the `wasmer` package (to compile WebAssembly module)",
"version": "1.1.0",
"project_urls": {
"Bug Tracker": "https://github.com/wasmerio/wasmer-python/issues",
"Documentation": "https://github.com/wasmerio/wasmer-python/",
"Source Code": "https://github.com/wasmerio/wasmer-python"
},
"split_keywords": [
"python",
"extension",
"webassembly"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c5cfe0ac8ec0dde10716668819eb894edddd15cece14fcb4c26ee82ed3d1f65e",
"md5": "2465fdb19855751515504e10a38aa9ab",
"sha256": "9869910179f39696a020edc5689f7759257ac1cce569a7a0fcf340c59788baad"
},
"downloads": -1,
"filename": "wasmer_compiler_cranelift-1.1.0-cp310-cp310-macosx_10_7_x86_64.whl",
"has_sig": false,
"md5_digest": "2465fdb19855751515504e10a38aa9ab",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": null,
"size": 1731266,
"upload_time": "2022-01-07T23:24:11",
"upload_time_iso_8601": "2022-01-07T23:24:11.614100Z",
"url": "https://files.pythonhosted.org/packages/c5/cf/e0ac8ec0dde10716668819eb894edddd15cece14fcb4c26ee82ed3d1f65e/wasmer_compiler_cranelift-1.1.0-cp310-cp310-macosx_10_7_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "749b1cb2c909ef82f464afed1cd799cfcae95063fc3233c5140819e4b4ceee54",
"md5": "402f0c115339506fc371b573f3453b9f",
"sha256": "405546ee864ac158a4107f374dfbb1c8d6cfb189829bdcd13050143a4bd98f28"
},
"downloads": -1,
"filename": "wasmer_compiler_cranelift-1.1.0-cp310-cp310-manylinux_2_24_x86_64.whl",
"has_sig": false,
"md5_digest": "402f0c115339506fc371b573f3453b9f",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": null,
"size": 1854396,
"upload_time": "2022-01-07T23:24:12",
"upload_time_iso_8601": "2022-01-07T23:24:12.878709Z",
"url": "https://files.pythonhosted.org/packages/74/9b/1cb2c909ef82f464afed1cd799cfcae95063fc3233c5140819e4b4ceee54/wasmer_compiler_cranelift-1.1.0-cp310-cp310-manylinux_2_24_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a146bf489a62c2f919ffcfce4b92c9d07e0257b14a1afd4fb122a7b64632c8ec",
"md5": "2d3e4b511ec766a88b4112d169745aa9",
"sha256": "bdf75af9ef082e6aeb752550f694273340ece970b65099e0746db0f972760d11"
},
"downloads": -1,
"filename": "wasmer_compiler_cranelift-1.1.0-cp310-none-win_amd64.whl",
"has_sig": false,
"md5_digest": "2d3e4b511ec766a88b4112d169745aa9",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": null,
"size": 1705776,
"upload_time": "2022-01-07T23:24:14",
"upload_time_iso_8601": "2022-01-07T23:24:14.097660Z",
"url": "https://files.pythonhosted.org/packages/a1/46/bf489a62c2f919ffcfce4b92c9d07e0257b14a1afd4fb122a7b64632c8ec/wasmer_compiler_cranelift-1.1.0-cp310-none-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "dde2764ec90a14af189bee0b074f0a561a5465ab858325f2211dfb3a43ccd849",
"md5": "8a3882c135ee6ffb4fd28c34722c0c83",
"sha256": "7d9c782b7721789b16e303b7e70c59df370896dd62b77e2779e3a44b4e1aa20c"
},
"downloads": -1,
"filename": "wasmer_compiler_cranelift-1.1.0-cp37-cp37m-macosx_10_7_x86_64.whl",
"has_sig": false,
"md5_digest": "8a3882c135ee6ffb4fd28c34722c0c83",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 1731187,
"upload_time": "2022-01-07T23:24:15",
"upload_time_iso_8601": "2022-01-07T23:24:15.150766Z",
"url": "https://files.pythonhosted.org/packages/dd/e2/764ec90a14af189bee0b074f0a561a5465ab858325f2211dfb3a43ccd849/wasmer_compiler_cranelift-1.1.0-cp37-cp37m-macosx_10_7_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "31f9e8715ea33f468b756a9584e5de2a0e6e2139c0ad8b840556e5738e00f033",
"md5": "6b9e87fbcbad43853fac58f0c9d4d9a5",
"sha256": "ff7dd5bd69030b63521c24583bf0f5457cd2580237340b91ce35370f72a4a1cc"
},
"downloads": -1,
"filename": "wasmer_compiler_cranelift-1.1.0-cp37-cp37m-manylinux_2_24_x86_64.whl",
"has_sig": false,
"md5_digest": "6b9e87fbcbad43853fac58f0c9d4d9a5",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 1854020,
"upload_time": "2022-01-07T23:24:16",
"upload_time_iso_8601": "2022-01-07T23:24:16.552541Z",
"url": "https://files.pythonhosted.org/packages/31/f9/e8715ea33f468b756a9584e5de2a0e6e2139c0ad8b840556e5738e00f033/wasmer_compiler_cranelift-1.1.0-cp37-cp37m-manylinux_2_24_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bb37f0310144b46a62d343e497b499b0d381a05504562958bc60261173ed4e40",
"md5": "402ed7d1b6b250cd20ef08bc7fe62e54",
"sha256": "447285402e366a34667a674db70458c491acd6940b797c175c0b0027f48e64bb"
},
"downloads": -1,
"filename": "wasmer_compiler_cranelift-1.1.0-cp37-none-win_amd64.whl",
"has_sig": false,
"md5_digest": "402ed7d1b6b250cd20ef08bc7fe62e54",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 1706165,
"upload_time": "2022-01-07T23:24:17",
"upload_time_iso_8601": "2022-01-07T23:24:17.716192Z",
"url": "https://files.pythonhosted.org/packages/bb/37/f0310144b46a62d343e497b499b0d381a05504562958bc60261173ed4e40/wasmer_compiler_cranelift-1.1.0-cp37-none-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a87817379b136986bde52436baec888cbabe9b4978d897e1f0e59d259e999f1e",
"md5": "8c931ac6063990854c13e2cdccfa79e8",
"sha256": "55a524985179f6b7b88ac973e8fac5a2574d3b125a966fba75fedd5a2525e484"
},
"downloads": -1,
"filename": "wasmer_compiler_cranelift-1.1.0-cp38-cp38-macosx_10_7_x86_64.whl",
"has_sig": false,
"md5_digest": "8c931ac6063990854c13e2cdccfa79e8",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": null,
"size": 1731169,
"upload_time": "2022-01-07T23:24:18",
"upload_time_iso_8601": "2022-01-07T23:24:18.845100Z",
"url": "https://files.pythonhosted.org/packages/a8/78/17379b136986bde52436baec888cbabe9b4978d897e1f0e59d259e999f1e/wasmer_compiler_cranelift-1.1.0-cp38-cp38-macosx_10_7_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cb21de4acefca40dc2577e122387924bc8ce3c6f64d852d84b3ae0ada2c3433b",
"md5": "e9eea64d9d336e3f54544302b636ca97",
"sha256": "bd03db5a916ead51b442c66acad38847dfe127cf90b2019b1680f1920c4f8d06"
},
"downloads": -1,
"filename": "wasmer_compiler_cranelift-1.1.0-cp38-cp38-manylinux_2_24_x86_64.whl",
"has_sig": false,
"md5_digest": "e9eea64d9d336e3f54544302b636ca97",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": null,
"size": 1854031,
"upload_time": "2022-01-07T23:24:20",
"upload_time_iso_8601": "2022-01-07T23:24:20.175518Z",
"url": "https://files.pythonhosted.org/packages/cb/21/de4acefca40dc2577e122387924bc8ce3c6f64d852d84b3ae0ada2c3433b/wasmer_compiler_cranelift-1.1.0-cp38-cp38-manylinux_2_24_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b2209ce82e8304f2d7aea0cc20e5edff6bbcba0db25ced227eff785fe0659f8d",
"md5": "f0f195e4af27279aa5582558d6e8c5a7",
"sha256": "157d87cbd1d04adbad55b50cb4bedc28e444caf74797fd96df17390667e58699"
},
"downloads": -1,
"filename": "wasmer_compiler_cranelift-1.1.0-cp38-none-win_amd64.whl",
"has_sig": false,
"md5_digest": "f0f195e4af27279aa5582558d6e8c5a7",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": null,
"size": 1705785,
"upload_time": "2022-01-07T23:24:21",
"upload_time_iso_8601": "2022-01-07T23:24:21.865932Z",
"url": "https://files.pythonhosted.org/packages/b2/20/9ce82e8304f2d7aea0cc20e5edff6bbcba0db25ced227eff785fe0659f8d/wasmer_compiler_cranelift-1.1.0-cp38-none-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ca1d3939962967d69d6bb1ac9af5a9adc5e91de4e9175db3e4519efaa3089c33",
"md5": "4baa8185e7633b90cfc6cdd3085c94c4",
"sha256": "ff25fc99ebafa04a6c271d08a90d17b927930e3019a2b333c7cfb48ba32c6f71"
},
"downloads": -1,
"filename": "wasmer_compiler_cranelift-1.1.0-cp39-cp39-macosx_10_7_x86_64.whl",
"has_sig": false,
"md5_digest": "4baa8185e7633b90cfc6cdd3085c94c4",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": null,
"size": 1731376,
"upload_time": "2022-01-07T23:24:23",
"upload_time_iso_8601": "2022-01-07T23:24:23.013392Z",
"url": "https://files.pythonhosted.org/packages/ca/1d/3939962967d69d6bb1ac9af5a9adc5e91de4e9175db3e4519efaa3089c33/wasmer_compiler_cranelift-1.1.0-cp39-cp39-macosx_10_7_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "58d459f83cc93f9197792deada522f681b399317672c3cbb7220608b0bf1f56c",
"md5": "e8c85a101dcdc01327e5619502d0ebb6",
"sha256": "9697ae082317a56776df8ff7df8c922eac38488ef38d3478fe5f0ca144c185ab"
},
"downloads": -1,
"filename": "wasmer_compiler_cranelift-1.1.0-cp39-cp39-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "e8c85a101dcdc01327e5619502d0ebb6",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": null,
"size": 1564678,
"upload_time": "2022-01-10T10:28:18",
"upload_time_iso_8601": "2022-01-10T10:28:18.015123Z",
"url": "https://files.pythonhosted.org/packages/58/d4/59f83cc93f9197792deada522f681b399317672c3cbb7220608b0bf1f56c/wasmer_compiler_cranelift-1.1.0-cp39-cp39-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "22e227122079b440e06c19596e74819fd11b613823ba666005971ad42ebf6e8a",
"md5": "d97614d36231239b617dc42b1bc66b48",
"sha256": "2a4349b1ddd727bd46bc5ede741839dcfc5153c52f064a83998c4150d5d4a85c"
},
"downloads": -1,
"filename": "wasmer_compiler_cranelift-1.1.0-cp39-cp39-manylinux_2_24_x86_64.whl",
"has_sig": false,
"md5_digest": "d97614d36231239b617dc42b1bc66b48",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": null,
"size": 1854451,
"upload_time": "2022-01-07T23:24:24",
"upload_time_iso_8601": "2022-01-07T23:24:24.134763Z",
"url": "https://files.pythonhosted.org/packages/22/e2/27122079b440e06c19596e74819fd11b613823ba666005971ad42ebf6e8a/wasmer_compiler_cranelift-1.1.0-cp39-cp39-manylinux_2_24_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2737ef18f10d98055dfb992ffb8eafbdf19cedaf28e10037eeaa213760f0d138",
"md5": "cbcc36d37dae588c69f02b44f70fd228",
"sha256": "32fe38614fccc933da77ee4372904a5fa9c12b859209a2e4048a8284c4c371f2"
},
"downloads": -1,
"filename": "wasmer_compiler_cranelift-1.1.0-cp39-none-win_amd64.whl",
"has_sig": false,
"md5_digest": "cbcc36d37dae588c69f02b44f70fd228",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": null,
"size": 1705754,
"upload_time": "2022-01-07T23:24:25",
"upload_time_iso_8601": "2022-01-07T23:24:25.459320Z",
"url": "https://files.pythonhosted.org/packages/27/37/ef18f10d98055dfb992ffb8eafbdf19cedaf28e10037eeaa213760f0d138/wasmer_compiler_cranelift-1.1.0-cp39-none-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "28fa26489c8f25470a3d50994aac8ebeabb2ca7f88874a15e0e77272b3a912c4",
"md5": "51bc0864519a20c82f6160db2395fbbb",
"sha256": "200fea80609cfb088457327acf66d5aa61f4c4f66b5a71133ada960b534c7355"
},
"downloads": -1,
"filename": "wasmer_compiler_cranelift-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "51bc0864519a20c82f6160db2395fbbb",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 1866,
"upload_time": "2022-01-07T23:24:26",
"upload_time_iso_8601": "2022-01-07T23:24:26.736147Z",
"url": "https://files.pythonhosted.org/packages/28/fa/26489c8f25470a3d50994aac8ebeabb2ca7f88874a15e0e77272b3a912c4/wasmer_compiler_cranelift-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-01-07 23:24:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "wasmerio",
"github_project": "wasmer-python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "wasmer-compiler-cranelift"
}