Skip to content

CI Run test suite inside Pyodide - #27346

Merged
thomasjpfan merged 24 commits into
scikit-learn:mainfrom
lesteve:run-tests-in-pyodide
Sep 28, 2023
Merged

thomasjpfan merged 24 commits into
scikit-learn:mainfrom
lesteve:run-tests-in-pyodide

Conversation

@lesteve

@lesteve lesteve commented Sep 12, 2023 •

Copy link
Copy Markdown
Member

With Pyodide 0.24, the scikit-learn test suite should pass (except a few tests that can be xfailed due to Pyodide limitations).

@github-actions

github-actions Bot commented Sep 15, 2023 •

Copy link
Copy Markdown

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 4d911d6. Link to the linter CI: here

@lesteve
lesteve marked this pull request as ready for review September 20, 2023 07:42
@lesteve

lesteve commented Sep 20, 2023 •

Copy link
Copy Markdown
Member Author

I am marking this PR as ready for review. Here are a few comments:

  • pyodide build has a bug in 0.24, this is fixed in Pyodide main but not in a release yet see Fix replacing local include paths pyodide/pyodide#4136. For now I am applying a patch manually to be able to build a Pyodide wheel
  • there is a genuine test failure in sklearn/utils/tests/test_sparsefuncs.py test_min_max with sparse arrays and int64 index dtype that has been introduced recently by one of the sparse array PRs that add tests for sparse arrays (see build log). For now I have marked this test as xfailed and I propose to tackle this in a separate PR.
  • codecov failure is due to the fact that Pyodide does not upload its coverage. I think we can live with this for now.

@lesteve lesteve changed the title Run test suite inside Pyodide CI Run test suite inside Pyodide Sep 20, 2023
@glemaitre
glemaitre self-requested a review September 25, 2023 15:41

@ogrisel ogrisel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM besides the following suggestions:

Comment thread sklearn/utils/tests/test_sparsefuncs.py Resolved
@@ -14,9 +14,3 @@ pip install pyodide-build==$PYODIDE_VERSION pyodide-cli
pyodide build

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would it be possible to speed-up the build by configuring ccache as we do for the other linux and macos builds?

@lesteve lesteve Sep 26, 2023 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Maybe in a separate PR?

I tried setting ccache with emscripten locally and for some reason, I get a poor cache hit rate of ~30%. Locally building without the cache takes ~4 minutes and with the cache ~3 minutes. I am not too sure how this would translate in the CI.

Right now, building the wheel is ~10 minutes and running the tests ~25 minutes.

pyodide venv pyodide-venv
source pyodide-venv/bin/activate

pip install dist/*.whl

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why isn't this step no longer required? Is it because we this is replaced by npm install pyodide@$PYODIDE_VERSION?

If so, why not call npm install as part of the install_pyodide.sh script?

@lesteve lesteve Sep 26, 2023 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The Pyodide venv does not work with scipy.linalg for now (pyodide/pyodide#3865), so you need to go the js wrapper way. Previously we were only importing scikit-learn and avoiding the issue.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we add a comment here or above npm install pyodide@$PYODIDE_VERSION to explain the situation?

Comment thread sklearn/_loss/tests/test_loss.py Resolved
Comment thread sklearn/utils/tests/test_sparsefuncs.py Resolved
pyodide venv pyodide-venv
source pyodide-venv/bin/activate

pip install dist/*.whl

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we add a comment here or above npm install pyodide@$PYODIDE_VERSION to explain the situation?

@thomasjpfan thomasjpfan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@thomasjpfan
thomasjpfan merged commit 751ccc0 into scikit-learn:main Sep 28, 2023
@lesteve
lesteve deleted the run-tests-in-pyodide branch September 29, 2023 07:33
@lesteve

lesteve commented Sep 29, 2023

Copy link
Copy Markdown
Member Author

Nice to see this one merged!

@glemaitre
glemaitre removed their request for review September 29, 2023 20:23
KartikeyBartwal added a commit to KartikeyBartwal/scikit-learn that referenced this pull request Sep 30, 2023
REDVM pushed a commit to REDVM/scikit-learn that referenced this pull request Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants