Skip to content

Commit b1194d3

Browse files
committed
ENH: Add jupyterlite configuration
1 parent 18a72d4 commit b1194d3

File tree

5 files changed

+51
-2
lines changed

5 files changed

+51
-2
lines changed

docs/conf.py

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@
1313
# import os
1414
# import sys
1515
# sys.path.insert(0, os.path.abspath('.'))
16+
from pathlib import Path
17+
from sphinx.application import Sphinx
18+
import subprocess
19+
import os
20+
import json
1621

22+
RTD = json.loads(os.environ.get("READTHEDOCS", "False").lower())
1723

1824
# -- Project information -----------------------------------------------------
1925

@@ -30,7 +36,16 @@
3036
# Add any Sphinx extension module names here, as strings. They can be
3137
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3238
# ones.
33-
extensions = ['myst_parser']
39+
extensions = ['myst_parser',]
40+
41+
here = Path(__file__).parent.resolve()
42+
jupyterlite_config = here / "jupyterlite_config.json"
43+
44+
html_theme_options = dict(
45+
github_url='https://github.com/InsightSoftwareConsortium/itkwidgets'
46+
)
47+
48+
# jupyterlite_config = jupyterlite_dir / "jupyterlite_config.json"
3449

3550
# Add any paths that contain templates here, relative to this directory.
3651
templates_path = ['_templates']
@@ -51,4 +66,15 @@
5166
# Add any paths that contain custom static files (such as style sheets) here,
5267
# relative to this directory. They are copied after the builtin static files,
5368
# so a file named "default.css" will overwrite the builtin "default.css".
54-
html_static_path = ['_static']
69+
html_static_path = ['_static',
70+
'_output']
71+
72+
def jupyterlite_build(app: Sphinx, error):
73+
subprocess.check_call(['jupyter', 'lite', 'build', '--config',
74+
str(jupyterlite_config)], cwd=str(here))
75+
76+
def setup(app):
77+
# For local builds, run jupyter lite build manually
78+
# $ jupyter lite serve --config ./jupyterlite_config.json
79+
if RTD:
80+
app.connect("config-inited", jupyterlite_build)

docs/images/Hello3DWorld.gif

2.91 MB
Loading

docs/index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ powered by [itk-wasm](https://wasm.itk.org) and [ImJoy](https://imjoy.io/).
1010
*Welcome to The Future* 🔬🚀🛸!
1111
```
1212

13+
<a href="./_static/retro/notebooks/?path=Hello3DWorld.ipynb">
14+
Try it with JupyterLite!
15+
16+
![Jupyterlite](https://jupyterlite.rtfd.io/en/latest/_static/badge.svg)
17+
18+
![Hello3DWorld](./images/Hello3DWorld.gif)
19+
</a>
20+
1321
```{toctree}
1422
quick_start_guide.rst
1523
deployments.rst

docs/jupyterlite_config.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"LiteBuildConfig": {
3+
"federated_extensions": [
4+
"https://files.pythonhosted.org/packages/15/ef/d7553d9968f317d02ee3e7819be5c9fc6cfa48e9fb3cf0cf92043c6a4205/imjoy_jupyterlab_extension-0.1.13-py3-none-any.whl"
5+
],
6+
"ignore_sys_prefix": true,
7+
"piplite_urls": [
8+
"https://files.pythonhosted.org/packages/14/f7/ea85b5e4f59db353340543d450cd3d1c5befcde8bee0cc41a9de78fed82f/itkwasm-1.0b1-py3-none-any.whl",
9+
"https://files.pythonhosted.org/packages/e5/e7/3df714a23e165e1097825a6f53c18c3d1c7850de58b5c4ffe6c5a15518bf/imjoy_rpc-0.5.13-py3-none-any.whl",
10+
"https://files.pythonhosted.org/packages/69/d9/5a6c8af2f4b4f49a809ae316ae4c12937d7dfda4e5b2f9e4167df5f15c0e/imjoy_utils-0.1.2-py3-none-any.whl",
11+
"https://files.pythonhosted.org/packages/d1/2c/b2ac53f14e28a2c84446f84b6463561b0b66c839f2f7f2b723264a6a03ec/itkwidgets-1.0a5-py3-none-any.whl"
12+
]
13+
}
14+
}

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
pydata-sphinx-theme
22
myst-parser
3+
jupyterlite[all]

0 commit comments

Comments
 (0)