-
-
Notifications
You must be signed in to change notification settings - Fork 863
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
Flexible jsimport take two #1146
Conversation
7a70b80
to
6ba0d26
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a huge fan of a python-based implementation. I've left a few minor comments.
… a bit more appropriate
I think this is good to go after some documentation and changelog. (also, your description in the OP refers to the old names of the new API) |
So for docs
I edited the description, thanks. |
An FAQ entry would be nice, I think. "How do I create custom python packages from javascript" |
Okay, I added some docs. Let me know if you have any complaints. |
Now that the tricky #461 / #788 bug complex has been resolved, there is a much easier implementation for "flexible js import". This PR resolves #960.
I added two new APIS to the
pyodide-js
module:pyodide.registerPackage(name, object)
andpyodide.unregisterPackage(name)
.pyodide.registerPackage
adds a new javascript object to the import path, whilepyodide.unregisterPackage
will remove the javascript object from the import path (though if the object has already been imported, it must also be removed fromsys.modules
as well to actually remove it).