question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is this library any good for using wasm libs in python?

See original GitHub issue

I made a very minimal example:

Rust code compiled to wasm32-wasi

use wasm_bindgen::prelude::*;

#[wasm_bindgen]
pub fn hello()->String{
    String::from("Hello World!")
}

Python code to use it

>>> from wasmtime import loader
>>> import my_test
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/wasmtime/loader.py", line 71, in exec_module
    imported_module = importlib.import_module(module_name)
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '__wbindgen_placeholder__'

Is it possible at all to use this wasmtime-py for calling functions out of a wasi library?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
alexcrichtoncommented, Nov 2, 2020

Unfortunately there is not a prototype of interface types as it exists today, but we’re working on getting one off the ground in wasmtime!

1reaction
alexcrichtoncommented, Oct 29, 2020

This is where the interface between the host and the wasm module itself is very low-level right now, it’s akin to dealing with a C ABI but even a bit harder than that. For a buttery-smooth interface like you want you’ll want to wait for interface types in wasm, since this is the problem they’re trying to solve.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[WASM] Unvendoring some of stdlib modules - WebAssembly
In Pyodide, we are using “unvendoring” approach: we remove some of the infrequently used stdlib modules from the core Python distribution, ...
Read more >
Running Python in the Browser with WebAssembly
In this tutorial, you'll build a Python code editor in the browser using WebAssembly (WASM), via Pyodide, and CodeMirror.
Read more >
Wasmer: A Python library for executing WebAssembly binaries
Looks good! Just for my understanding, what would be the advantage of working with wasm binaries instead of, let's say, C external libraries...
Read more >
wasmerio/wasmer-python: WebAssembly runtime for ... - GitHub
The wasmer package brings the required API to execute WebAssembly modules. In a nutshell, wasmer compiles the WebAssembly module into compiled code, and...
Read more >
Python in the browser with WebAssembly and Cables.gl
What if you could code in Python instead of JavaScript in your browser? With WebAssembly and the Pyodide framework, you now have access...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found