wasmer-python icon indicating copy to clipboard operation
wasmer-python copied to clipboard

Allow CLI usage: `$ python -m wasmer mybin.wasm`

Open alanjds opened this issue 2 years ago • 1 comments

Motivation

We can user wasmer directly if installed directly. But if we have the Python module already installed, is also useful to call it thru Python for testing and for when you cannot install wasmer in another way. Like in constrained systems/images that only have Python available, not even curl.

Proposed solution

Take an example of running a .wasm file in the filesystem and bake a CLI on -m wasmer that accepts that file and runs it, via __main__.py, as a Python wrapper over Wasmer via wasmer-python:

$ python -m wasmer mybin.wasm

Alternatives

An entrypoint could be discussed to be installed with the Python module, like wasmer-python, so you can call it directly via $ wasmer-python mybin.wasm, but this can lead to confusion and also be seen as a "recommended" way. Also clutters the global CLI namespace.

Calling the module directly only does not have this issues

alanjds avatar May 24 '22 14:05 alanjds

This is an interesting idea! I'd love to have it supported, would you like to contribute with a PR? :)

syrusakbary avatar Jun 01 '22 23:06 syrusakbary