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

WASI imports should return a dict #581

Merged
merged 2 commits into from
Dec 20, 2021
Merged

WASI imports should return a dict #581

merged 2 commits into from
Dec 20, 2021

Conversation

syrusakbary
Copy link
Member

This PR depends on this:

wasmerio/wasmer#2726

@@ -465,14 +465,14 @@ impl Environment {
/// import_object = wasi_env.generate_import_object(store, wasi.Version.SNAPSHOT1)
/// ```
//#[pyo3(text_signature = "($self, store, wasi_version)")]
fn generate_import_object(&self, store: &Store, wasi_version: Version) -> ImportObject {
fn generate_import_object(&self, store: &Store, wasi_version: Version) -> PyResult<PyObject> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this a breaking change? If we're OK making breaking changes then we should eliminate ImportObject from the python API entirely and just use dict everyone.

Copy link
Member Author

@syrusakbary syrusakbary Dec 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is a slight small breaking change (on the return type), but all APIs behave the same (with the exception of not being able to call register on the WASI Import Object, although I think that use case is very limited and I doubt people were using it)

I was thinking on removing the ImportObject, but if we do that we will make invalid a lot of existing code that rely on Wasmer Python. I think we can just mark it as deprecated for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer if we had a separate function which returns a dict, while keeping the existing one. This would avoid any breaking changes.

We can always clean this up later when we make a new release with breaking changes (3.0?).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable. Can you handle this from here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

@@ -186,6 +200,43 @@ impl ImportObject {
self.inner.contains_namespace(namespace_name)
}

/// Gets an `ImportObject` from a Python dictionary.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment seems to be the wrong way around.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooops

@syrusakbary syrusakbary merged commit 475828b into master Dec 20, 2021
@bors bors bot deleted the wasi-imports branch December 20, 2021 17:30
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 this pull request may close these issues.

2 participants