PyWavelets / pywt

PyWavelets - Wavelet Transforms in Python
http://pywavelets.readthedocs.org
MIT License
1.97k stars 460 forks source link

Build and test PyWavelets Pyodide wheels in CI #701

Closed agriyakhetarpal closed 4 months ago

agriyakhetarpal commented 4 months ago

This PR adds and configures a CI job to test wasm32 wheels for Pywavelets compiled via the Emscripten toolchain. Almost all tests pass, and some of them are skipped because of the current lack of threading for Pyodide (please refer to https://github.com/pyodide/pyodide/issues/237).

It is likely that Pyodide has issues with file system access which was evident through OSErrors when trying to access .npy files, it's likely that this is a bug and I shall file it accordingly in the Pyodide issue tracker. The current workaround that has been adopted in this PR is to save the arrays loaded from these .npy files to compressed .npz file formats, which do not cause issues related to file permissions.

An IS_WASM check has been added to check for the platform and allow pytest to skip the concurrency-based tests after collection, as noted above.

agriyakhetarpal commented 4 months ago

Pyodide wheel builds are succeeding and tests are passing on my fork, see here: https://github.com/agriyakhetarpal/pywt/actions/runs/8003758318

agriyakhetarpal commented 4 months ago

Okay, so importlib.resources.files() is available on Python 3.9 and later we already support Python 3.9 and later, we might have to revert this change or look at other ways to access the data folder without the use of __file__, or reintroduce it and check if this was one of the issues that caused test failures earlier. Should be addressed by https://github.com/PyWavelets/pywt/pull/701/commits/7315b43187cd10dc7a712da947ca7e13337c9a2b.

agriyakhetarpal commented 4 months ago

Thanks for the prompt review, @rgommers! It did take a bit of back and forth with the experiments – I don't have a strong opinion on rewriting history as such; it would be great if we can squash merge the PR, it's much easier