-
Notifications
You must be signed in to change notification settings - Fork 34
Use as_py_json in place of deprecated as_object_map for Pyodide>=0.29
#201
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
Conversation
|
The failing tests are unrelated here. Here is a very simple code snippet that I used on the Pyodide console to verify that the library lookup is working (please install a few compiled packages, say, from pyodide_js._module import LDSO
import os
found_libs = []
all_keys = []
for filepath in LDSO.loadedLibsByName.as_py_json():
all_keys.append(filepath)
if os.path.exists(filepath):
found_libs.append(filepath)
print(f"Total library keys: {len(all_keys)}")
print(f"Libraries that exist on the file system: {len(found_libs)}")
if found_libs:
print("\n Here are the first ten real library files:")
for lib in found_libs[:10]:
print(f" {lib}")
else:
print("\nNo libraries found on filesystem")
print("Sample keys from LDSO.loadedLibsByName:")
for key in all_keys[:10]:
print(f" {key}")which gives me the following output: |
lesteve
left a comment
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 double-checked in a Pyodide console that as_py_json was working fine.
Since as_py_json was added in Pyodide 0.29, I would add something based on getattr or try/except to make sure that it works with Pyodide < 0.29.
The CI errors don't seem related.
|
On it! |
as_py_json in place of deprecated as_object_map for Pyodide shared libraries lookupas_py_json in place of deprecated as_object_map for looking up shared libraries for Pyodide v0.29 and later
lesteve
left a comment
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.
LGTM, thanks!
as_py_json in place of deprecated as_object_map for looking up shared libraries for Pyodide v0.29 and lateras_py_json in place of deprecated as_object_map for Pyodide>=0.29
We deprecated this method with Pyodide v0.29, and it will be removed in Pyodide v0.31. See pyodide/pyodide#5010, which adds a replacement that should work out of the box as it supports the
IS_PY_JSON_DICTflag.I tested this on the Pyodide dev and stable consoles with a few packages installed; it works well. I'll open a separate issue to discuss whether we want to smoke test Pyodide in-tree here.
cc: @lesteve
xref: scikit-image/scikit-image#7931