Skip to content

DOC Use nightly WASM wheels for JupyterLite in the dev documentation #31085

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

Merged

Conversation

agriyakhetarpal
Copy link
Contributor

Reference Issues/PRs

This PR builds on top of #29791 and #31078

What does this implement/fix? Explain your changes.

This PR updates the Sphinx-Gallery notebook modification function to install the Pyodide/WASM wheels for scikit-learn which are now available on https://anaconda.org/scientific-python-nightly-wheels/scikit-learn. This allows the JupyterLite-based interactive notebooks in the "Examples" section of the development version of the scikit-learn documentation to use as close to a tip-of-tree version of scikit-learn as it can be.

cc: @lesteve

Any other comments?

N/A

Copy link

github-actions bot commented Mar 26, 2025

✔️ Linting Passed

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

Generated for commit: dcb01db. Link to the linter CI: here

@agriyakhetarpal
Copy link
Contributor Author

This can be tried out from the JupyterLite deployment from this PR, which can now be used to run the latest code through the nightly wheels:

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.

Nice, thanks for the PR!

I tested your links and double-checked that the scikit-learn dev version was indeed used.

doc/conf.py Outdated
Comment on lines 693 to 695
" 'scikit-learn',\n"
" index_urls='https://pypi.anaconda.org/scientific-python-nightly-wheels/simple',\n"
" pre=True,\n"
Copy link
Member

Choose a reason for hiding this comment

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

Maybe something like this would be better?

Suggested change
" 'scikit-learn',\n"
" index_urls='https://pypi.anaconda.org/scientific-python-nightly-wheels/simple',\n"
" pre=True,\n"
f" 'scikit-learn={release!r}',\n"
" index_urls='https://pypi.anaconda.org/scientific-python-nightly-wheels/simple',\n"

There may be a future where we have a 1.6.1 Pyodide wheel and this will work more easily?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe something like this would be better?

I agree!

There may be a future where we have a 1.6.1 Pyodide wheel and this will work more easily?

There is jupyterlite-pyodide-kernel==0.6.0a4 which uses Pyodide 0.27.4 with scikit-learn 1.6.1, should I switch to it or would you like to wait until 0.6.0 stable lands? Here's the linked issue: jupyterlite/jupyterlite#1554

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I applied your suggestion in 5416684. I had to drop the raw string as it gets interpreted as 'scikit-learn=='1.7.dev0'', instead, which is invalid syntax.

Copy link
Member

Choose a reason for hiding this comment

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

There is jupyterlite-pyodide-kernel==0.6.0a4 which uses Pyodide 0.27.4 with scikit-learn 1.6.1, should I switch to it or would you like to wait until 0.6.0 stable lands?

Thanks! I think we are fine to wait until jupyterlite-pyodide-kernel 0.6.0 lands.

agriyakhetarpal and others added 2 commits March 27, 2025 16:42
Co-Authored-By: Loïc Estève <1680079+lesteve@users.noreply.github.com>
Co-Authored-By: Loïc Estève <1680079+lesteve@users.noreply.github.com>
@agriyakhetarpal agriyakhetarpal requested a review from lesteve March 27, 2025 11:33
@agriyakhetarpal
Copy link
Contributor Author

Okay, the docs build passed and it seems to work well: https://output.circle-artifacts.com/output/job/7f6760fe-141c-4a9a-a8fe-3d1c1e09014a/artifacts/0/doc/lite/lab/index.html?path=auto_examples%2Fneighbors%2Fplot_regression.ipynb

I do have to keep clearing the cookies/site data/cache, etc. to ensure I get the latest changes within the JupyterLite deployment. I wonder if we can support this without jupyterlite/jupyterlite-sphinx#121 so that we always have wheels cached in the browser storage – perhaps by adding UUIDs to the builds created by jupyterlite-sphinx by modifying jupyter-lite.json's jupyter-config-data.appName if one exists (or create and assign a UUID before building).

@agriyakhetarpal
Copy link
Contributor Author

Actually, it looks like that behaviour can change with the upcoming JupyterLite 0.6.0, so we won't need to do anything: jupyterlite/jupyterlite#1601

@lesteve
Copy link
Member

lesteve commented Mar 27, 2025

Actually, it looks like that behaviour can change with the upcoming JupyterLite 0.6.0, so we won't need to do anything: jupyterlite/jupyterlite#1601

Good to know! FYI I am sitting next to @jtpio right now and my understanding is that the jupyterlite 0.6 is coming soonish.

@lesteve lesteve changed the title ENH, DOC Use nightly WASM wheels for JupyterLite in the development version of the scikit-learn documentation DOC Use nightly WASM wheels for JupyterLite in the development version of the scikit-learn documentation Mar 27, 2025
@lesteve lesteve changed the title DOC Use nightly WASM wheels for JupyterLite in the development version of the scikit-learn documentation DOC Use nightly WASM wheels for JupyterLite in the dev documentation Mar 27, 2025
@lesteve
Copy link
Member

lesteve commented Mar 27, 2025

I'll leave this PR open to wait for a second opinion, but I think this can be merged and we can always iterate in further PRs.

Copy link
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

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

Thanks very much for the PR. This is great!

@ogrisel ogrisel merged commit 187197f into scikit-learn:main Mar 28, 2025
38 checks passed
@agriyakhetarpal agriyakhetarpal deleted the feat/use-nightly-wheels-for-docs branch March 28, 2025 16:17
@lesteve
Copy link
Member

lesteve commented Mar 31, 2025

Great to see this milestone achieved 🎉, thanks @agriyakhetarpal for your work on this!

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