Skip to content

Conversation

@agriyakhetarpal
Copy link
Contributor

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_DICT flag.

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

@agriyakhetarpal
Copy link
Contributor Author

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, numpy and so on, so that there is something to look up in the first place):

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:

Total library keys: 20
Libraries that exist on the file system: 19
... 
 Here are the first ten real library files:
  /lib/python3.13/site-packages/numpy/_core/_multiarray_umath.cpython-313-wasm32-emscripten.so
  /lib/python3.13/site-packages/numpy/fft/_pocketfft_umath.cpython-313-wasm32-emscripten.so
  /lib/python3.13/site-packages/numpy/linalg/_umath_linalg.cpython-313-wasm32-emscripten.so
  /lib/python3.13/site-packages/numpy/linalg/lapack_lite.cpython-313-wasm32-emscripten.so
  /lib/python3.13/site-packages/numpy/random/_bounded_integers.cpython-313-wasm32-emscripten.so
  /lib/python3.13/site-packages/numpy/random/_common.cpython-313-wasm32-emscripten.so
  /lib/python3.13/site-packages/numpy/random/_generator.cpython-313-wasm32-emscripten.so
  /lib/python3.13/site-packages/numpy/random/_mt19937.cpython-313-wasm32-emscripten.so
  /lib/python3.13/site-packages/numpy/random/_pcg64.cpython-313-wasm32-emscripten.so
  /lib/python3.13/site-packages/numpy/random/_philox.cpython-313-wasm32-emscripten.so

Copy link
Member

@lesteve lesteve left a 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.

@agriyakhetarpal
Copy link
Contributor Author

On it!

@agriyakhetarpal agriyakhetarpal changed the title Use as_py_json in place of deprecated as_object_map for Pyodide shared libraries lookup Use as_py_json in place of deprecated as_object_map for looking up shared libraries for Pyodide v0.29 and later Nov 6, 2025
Copy link
Member

@lesteve lesteve left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@lesteve lesteve changed the title Use as_py_json in place of deprecated as_object_map for looking up shared libraries for Pyodide v0.29 and later Use as_py_json in place of deprecated as_object_map for Pyodide>=0.29 Nov 6, 2025
@lesteve lesteve merged commit cf38a18 into joblib:master Nov 8, 2025
20 of 22 checks passed
@agriyakhetarpal agriyakhetarpal deleted the pyodide-0.29-update branch November 8, 2025 09:57
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