Skip to content
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

DOC enable jupyterlite for the gallery #633

Merged
merged 9 commits into from
Jul 19, 2023
Merged
38 changes: 29 additions & 9 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,22 +336,42 @@ def notebook_modification_function(notebook_content, notebook_filename):
]
)

message_class = "warning"
message = (
"Running the skrub examples in JupyterLite is experimental and you may"
" encounter some unexpected behavior.\n\nThe main difference is that imports"
" will take a lot longer than usual, for example the first `import skrub` can"
" take roughly 10-20s.\n\nIf you notice problems, feel free to open an"
" [issue](https://github.com/scikit-learn/scikit-learn/issues/new/choose)"
" about it."
)
if "06_ken_embeddings_example" in notebook_filename:
message_class = "danger"
message = (
"This example requires PyArrow that is not currently available in Pyodide: "
"https://github.com/pyodide/pyodide/issues/2933. Thus, this example cannot "
"be run in JupyterLite."
LilianBoulard marked this conversation as resolved.
Show resolved Hide resolved
)
else:
message_class = "warning"
message = (
"Running the skrub examples in JupyterLite is experimental and you may"
" encounter some unexpected behavior.\n\nThe main difference is that "
" imports will take a lot longer than usual, for example the first "
" `import skrub` can take roughly 10-20s.\n\nIf you notice problems, feel "
" free to open an "
"[issue](https://github.com/skrub-data/skrub/issues/new/choose) about it."
LilianBoulard marked this conversation as resolved.
Show resolved Hide resolved
)

markdown = warning_template.format(message_class=message_class, message=message)

dummy_notebook_content = {"cells": []}
add_markdown_cell(dummy_notebook_content, markdown)

# TODO: in the next release, we need to uncomment the following line that should
# replace the manual install from TestPyPI
# code_lines = ["%pip install skrub"]
code_lines = []
code_lines.extend(
[
"import micropip",
"await micropip.install("
"'https://test-files.pythonhosted.org/packages/3c/03/"
"e1598c7abe536e56834f568f61497ad075d966c4c8fb7d0ad004b81e7bfc/"
"skrub-0.0.1.dev1-py3-none-any.whl')"
]
)

if "seaborn" in notebook_content_str:
code_lines.append("%pip install seaborn")
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ doc =
numpydoc
jupyterlite-sphinx
jupyterlite-pyodide-kernel
pyarrow
benchmarks =
numpy
pandas
Expand Down
Loading