Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the top-level package class and general ergonomics #39

Closed
Michael-F-Bryan opened this issue Sep 27, 2022 · 1 comment · Fixed by #40
Closed

Remove the top-level package class and general ergonomics #39

Michael-F-Bryan opened this issue Sep 27, 2022 · 1 comment · Fixed by #40

Comments

@Michael-F-Bryan
Copy link
Contributor

It'd be more user-friendly if, instead of this...

https://github.com/wasmerio/wit-pack/blob/0b12fe02ca741cb34a74977aaf7b459220fb68fc/crates/wit-pack/tests/python-wasi/test_wabt.py#L6

https://github.com/wasmerio/wit-pack/blob/0b12fe02ca741cb34a74977aaf7b459220fb68fc/crates/wit-pack/tests/python-wasi/test_wabt.py#L18-L21

... people just needed to write this...

from wabt import bindings

wabt_library_instance = bindings.wabt()
wasm_result = wabt_library_instance.wat2wasm("(module)", WasmFeature.MUTABLE_GLOBALS)

CC: @syrusakbary

@Michael-F-Bryan Michael-F-Bryan changed the title Remove the top-level package class Remove the top-level package class and general ergonomics Sep 27, 2022
@syrusakbary
Copy link
Member

After thinking more about this, I think your proposal is the right one:

from wabt import bindings

wabt_library_instance = bindings.wabt()
wasm_result = wabt_library_instance.wat2wasm("(module)", WasmFeature.MUTABLE_GLOBALS)

Why? We may need to get the memory filesystem inside of the wabt_library_instance in a way that is reusable:

wabt_library_instance.fs.read_conents("abc")
# OR at instantiation
wabt_library_instance = bindings.wabt(mount={".": LocalFilesystem(".")})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants