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

Attempt to upgrade to Jupyterlite 0.2.3 #3

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,5 @@ ENV TARGET_DIR=${GITHUB_WORKSPACE:-/github/workspace}
CMD jupyter lite build \
--config /build/jupyter_lite_config.json \
--lite-dir /build \
--no-sourcemaps \
--output-dir notebooks \
--pyodide https://github.com/pyodide/pyodide/releases/download/0.23.2/pyodide-0.23.2.tar.bz2 \
&& tar -czf ${TARGET_DIR}/jupyter-lite-build.tgz notebooks
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Pyodide kernel and all dependencies according Jupyterlite [manual](https://jupyt

## How to

* The build is [Docker](./Dockerfile) based. For a local run try `docker run -it --rm -e TARGET_DIR=/dist -v "$(pwd)":/dist $(docker build -q .)`.
* The build is [Docker](./Dockerfile) based. For a local run try `docker run -it --rm -e TARGET_DIR=/dist -v "$(pwd)":/dist $(docker build .)`.
This will generate a `jupyter-lite-build.tgz` with the self-contained Jupyterlite web app in your current directory.
* On Github a [GH action](./action.yml) uses the Docker build and is embedded into the [build workflow](./.github/workflows/main.yml)
which also add the build artifact as a release asset.
Expand All @@ -23,3 +23,8 @@ Unzip the TGZ file which will then unpack into `./notebooks`.
Run either `python -m http.server 8000 --directory ./notebooks` or `ruby -run -ehttpd ./notebooks -p 8000`

Browse to http://localhost:8000 and you should see the Jupyterlite interface.


## Details

`./jupyterlite/jupyter_lite_config.json` defines all the files to be compiled at build time instead of run time for offline use. See https://jupyterlite.readthedocs.io/en/latest/howto/configure/advanced/offline.html
8 changes: 4 additions & 4 deletions jupyterlite/jupyter_lite_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"https://files.pythonhosted.org/packages/py2.py3/i/ipycanvas/ipycanvas-0.13.1-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/py2.py3/i/ipycytoscape/ipycytoscape-1.3.3-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/py2.py3/i/ipython-genutils/ipython_genutils-0.2.0-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/py2.py3/i/ipyvue/ipyvue-1.8.0-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/py2.py3/i/ipyvuetify/ipyvuetify-1.8.4-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/py2.py3/i/ipyvue/ipyvue-1.10.1-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/py2.py3/i/ipyvuetify/ipyvuetify-1.8.10-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/py2.py3/j/jsonpointer/jsonpointer-2.3-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/py2.py3/m/mistune/mistune-2.0.5-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/py2.py3/p/pandocfilters/pandocfilters-1.5.0-py2.py3-none-any.whl",
Expand All @@ -37,7 +37,7 @@
"https://files.pythonhosted.org/packages/py3/e/entrypoints/entrypoints-0.4-py3-none-any.whl",
"https://files.pythonhosted.org/packages/py3/f/fqdn/fqdn-1.5.1-py3-none-any.whl",
"https://files.pythonhosted.org/packages/py3/i/idna/idna-3.4-py3-none-any.whl",
"https://files.pythonhosted.org/packages/py3/i/ipyleaflet/ipyleaflet-0.17.2-py3-none-any.whl",
"https://files.pythonhosted.org/packages/py3/i/ipyleaflet/ipyleaflet-0.17.4-py3-none-any.whl",
"https://files.pythonhosted.org/packages/py3/i/ipython/ipython-8.10.0-py3-none-any.whl",
"https://files.pythonhosted.org/packages/py3/i/ipywidgets/ipywidgets-8.0.4-py3-none-any.whl",
"https://files.pythonhosted.org/packages/py3/i/isoduration/isoduration-20.11.0-py3-none-any.whl",
Expand Down Expand Up @@ -76,4 +76,4 @@
"https://files.pythonhosted.org/packages/py3/x/xyzservices/xyzservices-2022.9.0-py3-none-any.whl"
]
}
}
}
27 changes: 12 additions & 15 deletions jupyterlite/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Contents below from https://github.com/jupyterlite/demo/blob/main/requirements.txt

# Core modules (mandatory)
jupyterlite-core==0.1.0
jupyterlab~=3.5.1
jupyterlite-core==0.2.3
jupyterlab~=4.0.11
notebook~=7.0.7


# Python kernel (optional)
jupyterlite-pyodide-kernel==0.0.8
jupyterlite-pyodide-kernel==0.2.1

# JavaScript kernel (optional)
jupyterlite-javascript-kernel==0.1.0b21
jupyterlite-javascript-kernel==0.2.3

# Language support (optional)
jupyterlab-language-pack-fr-FR
Expand All @@ -22,18 +22,19 @@ jupyterlite-p5-kernel==0.1.0
jupyterlite-xeus-lua==0.3.1

# JupyterLab: Fasta file renderer (optional)
jupyterlab-fasta>=3,<4
jupyterlab-fasta>=3.3.0,<4
# JupyterLab: Geojson file renderer (optional)
jupyterlab-geojson>=3,<4
jupyterlab-geojson>=3.4.0,<4
# JupyterLab: guided tour (optional)
jupyterlab-tour
# TODO: re-enable after https://github.com/jupyterlab-contrib/jupyterlab-tour/issues/82
# jupyterlab-tour
# JupyterLab: dark theme
jupyterlab-night
# JupyterLab: Miami nights theme (optional)
jupyterlab_miami_nights

# Python: ipywidget library for Jupyter notebooks (optional)
ipywidgets>=8.0.0,<9
ipywidgets>=8.1.1,<9
# Python: ipyevents library for Jupyter notebooks (optional)
ipyevents>=2.0.1
# Python: interative Matplotlib library for Jupyter notebooks (optional)
Expand All @@ -43,11 +44,7 @@ ipycanvas>=0.9.1
# Python: ipyleaflet library for Jupyter notebooks (optional)
ipyleaflet

# Python: plotting libraries (optional)
plotly>=5,<6
bqplot


# Contents below added from https://jupyterlite.readthedocs.io/en/latest/howto/configure/advanced/offline.html

jupyterlite-core[mathjax]==0.1.0
#jupyterlite-core[mathjax]==0.1.0
27 changes: 27 additions & 0 deletions server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import http.server
import socketserver

PORT = 8080

class HttpRequestHandler(http.server.SimpleHTTPRequestHandler):
extensions_map = {
'': 'application/octet-stream',
'.manifest': 'text/cache-manifest',
'.html': 'text/html',
'.png': 'image/png',
'.jpg': 'image/jpg',
'.svg': 'image/svg+xml',
'.css': 'text/css',
'.js':'application/x-javascript',
'.wasm': 'application/wasm',
'.json': 'application/json',
'.xml': 'application/xml',
}

httpd = socketserver.TCPServer(("localhost", PORT), HttpRequestHandler)

try:
print(f"serving at http://localhost:{PORT}")
httpd.serve_forever()
except KeyboardInterrupt:
pass
Loading