Skip to content

Commit 187197f

Browse files
DOC Use nightly WASM wheels for JupyterLite in the dev documentation (scikit-learn#31085)
Co-authored-by: Loïc Estève <1680079+lesteve@users.noreply.github.com>
1 parent 0dbbac9 commit 187197f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

doc/conf.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,23 @@ def notebook_modification_function(notebook_content, notebook_filename):
682682
# imports inside functions
683683
code_lines.extend(["import matplotlib", "import pandas"])
684684

685+
# Work around https://github.com/jupyterlite/pyodide-kernel/issues/166
686+
# and https://github.com/pyodide/micropip/issues/223 by installing the
687+
# dependencies first, and then scikit-learn from Anaconda.org.
688+
if "dev" in release:
689+
dev_docs_specific_code = [
690+
"import piplite",
691+
"import joblib",
692+
"import threadpoolctl",
693+
"import scipy",
694+
"await piplite.install(\n"
695+
f" 'scikit-learn=={release}',\n"
696+
" index_urls='https://pypi.anaconda.org/scientific-python-nightly-wheels/simple',\n"
697+
")",
698+
]
699+
700+
code_lines.extend(dev_docs_specific_code)
701+
685702
if code_lines:
686703
code_lines = ["# JupyterLite-specific code"] + code_lines
687704
code = "\n".join(code_lines)

0 commit comments

Comments
 (0)