-
-
Notifications
You must be signed in to change notification settings - Fork 330
Add Pyodide support and CI jobs for Zarr #1903
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
base: main
Are you sure you want to change the base?
Conversation
Zarr v3 has |
Update: we added both Next, when Zarr v3 (stable) comes out on PyPI in the next month or so, I shall bump the version/recipe for the in-tree Pyodide build as well. It would be great to have the out-of-tree build, i.e., this PR, ready for review/merging by then, and I will be committed to putting my best efforts in doing so – thanks! |
The Pyodide 0.26.0 release is out, and we have been lucky to have got both |
f23d1d9
to
cdf0bb2
Compare
b52b6c4
to
7ae9a97
Compare
This is because they test async code and also use threads. See the following issues: pyodide/pyodide#2221 pyodide/pyodide#237
I can't request a review from you as you haven't been previously involved in this PR, @ryanking13, but it would be nice if you could take a look at it as well – thank you! |
# _numcodecs_version = Version(numcodecs.__version__) | ||
# if _numcodecs_version < Version("0.13.0"): | ||
# raise RuntimeError( | ||
# "numcodecs version >= 0.13.0 is required to use the zstd codec. " | ||
# f"Version {_numcodecs_version} is currently installed." | ||
# ) |
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.
How about skipping tests that require newer version of numcodecs?
src/zarr/core/sync.py
Outdated
Patch Pyodide's WebLoop to fix interoperability with pytest-asyncio. | ||
|
||
WebLoop.shutdown_asyncgens() raises NotImplementedError, which causes |
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.
Maybe we should implement it in Pyodide?
If this is only problematic in testing environment, how about moving this into conftest.py?
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.
Maybe we should implement it in Pyodide?
I haven't thought about it, but yes, I think this should be helpful to put somewhere in pytest-pyodide
, if I understand you correctly. I haven't come across this case/problem in any other downstream package, so I'm not sure (but perhaps Zarr is among the first).
If this is only problematic in testing environment, how about moving this into conftest.py?
Yes, makes sense to me! I'll move it to conftest.py
and make it run only when .PYTEST_CURRENT_TEST
is active
Edit: I've moved the patch to conftest.py
in bad9920
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 would prefer solving it in webloop rather than just in the test code if it's possible.
The tests are now passing in https://github.com/zarr-developers/zarr-python/actions/runs/15322119791/job/43108023246?pr=1903 (except the extremely slow ones – also, they don't exhibit the same level of slowness at all if you run them locally); and I've added a release note highlighting Pyodide/WebAssembly support. Codecov is going to complain because it isn't aware of this WebAssembly environment, so I'm happy to either mock it to absurdly boost the coverage value or skip those lines with a |
It would be nice to make coverage work with the webassembly tests too. Though we still haven't done it for Pyodide itself. |
Yes, I'd assume merely collecting or operating on coverage data should already work, as |
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.
For Pyodide-wise, it looks good to me.
@ryanking13 – I've corrected the error message based on your suggestion, thanks! @hoodmane, surfacing your conversation from above about solving the issue in Next, what I understand here is that |
Thanks for the investigation. If it only raises a runtime warning, I think it is okay to leave it as-is (without the fixture) in this PR. Apart from that, adding no-op implementation of |
Description
This description is a stub and will be updated in due course.
TODO:
Additional context
Here are a few xrefs to some other PRs that have been implemented for packages in the Scientific Python ecosystem:
scikit-image
): Build and test PyWavelets Pyodide wheels in CI PyWavelets/pywt#701 and Upload dev wheels to Anaconda.org + revamp wheels publishing workflow PyWavelets/pywt#714pandas
repository BLD, TST: Build and test Pyodide wheels forpandas
in CI pandas-dev/pandas#57896scikit-image
scikit-image/scikit-image#7350The greater, long-term goal towards this change is to implement Sphinx-based interactive documentation via JupyterLite and WASM-powered, in-browser kernels, as referenced in Quansight-Labs/czi-scientific-python-mgmt#19, see also: Quansight-Labs/czi-scientific-python-mgmt#18. A pilot that can be readily tried out is available for the "API reference" pages under the PyWavelets documentation. This will be preceded by configuring a place to publish these WebAssembly/Emscripten wheels nightly or on a scheduled cadence for Zarr (which could be a third-party, PyPI-like index such as Anaconda.org) and then integrating Sphinx extensions such as
jupyterlite-sphinx
for hosted documentation.