How to use the wasmer.__version__ function in wasmer

To help you get started, we’ve selected a few wasmer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wasmerio / python-ext-wasm / tests / test_instance.py View on Github external
def test_version():
    assert isinstance(wasmer.__version__, str)
github Mec-iS / rust-wasm-python-101 / pywasm / run_timing_collection.py View on Github external
wasm_bytes = bytecode.read()
        instance = Instance(wasm_bytes)
        # assign functions
        simple_add = instance.exports.simple_add
        fibo = instance.exports.fibo
        rust_geo_convex_hull = instance.exports.rust_geo_convex_hull

        # print exported functions
        print("Modules exported from Rust: ")
        print(instance.exports)

        # define metadata in results
        from collections import OrderedDict
        results = OrderedDict()
        results['timestap'] = str(datetime.now())
        results['python_wasmer_v'] = f'{wasmer.__version__}|{wasmer.__core_version__}'

        import subprocess
        rustc_v = subprocess.check_output(['rustc', '--version']).decode().rstrip()
        results['rustc_v'] = rustc_v

        results['data'] = {}

        t_py = timeit.timeit('[py_simple_add(n-1, n) for n in range(100, 1000)]', number=10000, setup='from examples.scientific import py_simple_add')
        print('py add', t_py)

        t_wasm = timeit.timeit('[simple_add(n-1, n) for n in range(100, 1000)]', number=10000, setup=context+'simple_add = instance.exports.simple_add')
        print('t_wasm add', t_wasm)
        results['data']['simple_add'] = { 'py': t_py, 'wasm': t_wasm }

        t_py = timeit.timeit('[py_fibonacci(n) for n in range(100, 1000)]', number=1000, setup='from examples.scientific import py_fibonacci')
        print('py fibo', t_py)