Skip to content

Commit c53d9a6

Browse files
Add JupyterLite deployment (#668)
* Add JupyterLite deployment * Add JupyterLite dependencies * Update build instructions * Remove duplicate wasm build
1 parent b24fff3 commit c53d9a6

File tree

5 files changed

+96
-42
lines changed

5 files changed

+96
-42
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: build and deploy
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
10+
permissions:
11+
contents: read
12+
pages: write
13+
id-token: write
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
include:
23+
- name: Github-page
24+
25+
steps:
26+
- uses: actions/checkout@v5
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Install mamba
31+
uses: mamba-org/setup-micromamba@v2
32+
with:
33+
environment-file: environment-wasm-build.yml
34+
init-shell: bash
35+
environment-name: xeus-python-wasm-build
36+
37+
- name: Set ncpus
38+
run: echo "ncpus=$(nproc --all)" >> $GITHUB_ENV
39+
40+
- name: Build xeus-python
41+
shell: bash -l {0}
42+
run: |
43+
micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32
44+
45+
set -eux
46+
47+
export PREFIX=$MAMBA_ROOT_PREFIX/envs/xeus-python-wasm-host
48+
echo "PREFIX=$PREFIX" >> $GITHUB_ENV
49+
50+
emcmake cmake . \
51+
-DCMAKE_PREFIX_PATH=$PREFIX \
52+
-DCMAKE_INSTALL_PREFIX=$PREFIX \
53+
-DCMAKE_BUILD_TYPE=Release \
54+
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
55+
-DXPYT_EMSCRIPTEN_WASM_BUILD=ON \
56+
-DCMAKE_VERBOSE_MAKEFILE=ON
57+
58+
emmake make -j${{ env.ncpus }} install
59+
60+
- name: Jupyter Lite integration
61+
shell: bash -l {0}
62+
run: |
63+
jupyter lite build \
64+
--XeusAddon.prefix=${{ env.PREFIX }} \
65+
--contents notebooks/xeus-python.ipynb \
66+
--output-dir dist
67+
68+
- name: Upload artifact
69+
uses: actions/upload-pages-artifact@v4
70+
with:
71+
path: ./dist
72+
73+
deploy:
74+
needs: build
75+
if: github.ref == 'refs/heads/main'
76+
permissions:
77+
pages: write
78+
id-token: write
79+
80+
environment:
81+
name: github-pages
82+
url: ${{ steps.deployment.outputs.page_url }}
83+
84+
runs-on: ubuntu-latest
85+
steps:
86+
- name: Deploy to GitHub Pages
87+
id: deployment
88+
uses: actions/deploy-pages@v4

.github/workflows/main.yml

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
build_type: [static_build, shared_build]
2727

2828
steps:
29-
- uses: actions/checkout@v4
29+
- uses: actions/checkout@v5
3030

3131
- name: Install micromamba
3232
uses: mamba-org/setup-micromamba@v2
@@ -87,7 +87,7 @@ jobs:
8787
build_type: [static_build, shared_build]
8888

8989
steps:
90-
- uses: actions/checkout@v4
90+
- uses: actions/checkout@v5
9191

9292
- name: Install micromamba
9393
uses: mamba-org/setup-micromamba@v2
@@ -144,43 +144,3 @@ jobs:
144144
timeout-minutes: 4
145145
working-directory: build\test
146146

147-
test-wasm:
148-
149-
runs-on: ubuntu-latest
150-
151-
strategy:
152-
fail-fast: false
153-
154-
steps:
155-
- uses: actions/checkout@v4
156-
157-
- name: install mamba
158-
uses: mamba-org/setup-micromamba@main
159-
with:
160-
environment-file: environment-wasm-build.yml
161-
init-shell: bash
162-
163-
- name: Build and pack xeus-python
164-
shell: bash -l {0}
165-
run: |
166-
micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32
167-
168-
mkdir build
169-
pushd build
170-
171-
export PREFIX=$MAMBA_ROOT_PREFIX/envs/xeus-python-wasm-host
172-
export CMAKE_PREFIX_PATH=$PREFIX
173-
export CMAKE_SYSTEM_PREFIX_PATH=$PREFIX
174-
175-
# remove all the fake pythons binaries
176-
rm -f $PREFIX/bin/python*
177-
178-
emcmake cmake \
179-
-DCMAKE_PREFIX_PATH=$PREFIX \
180-
-DCMAKE_INSTALL_PREFIX=$PREFIX \
181-
-DCMAKE_BUILD_TYPE=Release \
182-
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
183-
-DXPYT_EMSCRIPTEN_WASM_BUILD=ON \
184-
..
185-
186-
make -j4

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![GitHub Action CI](https://github.com/jupyter-xeus/xeus-python/actions/workflows/main.yml/badge.svg)](https://github.com/jupyter-xeus/xeus-python/actions/workflows/main.yml)
44
[![Documentation Status](http://readthedocs.org/projects/xeus-python/badge/?version=latest)](https://xeus-python.readthedocs.io/en/latest/?badge=latest)
55
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/jupyter-xeus/xeus-python/stable?urlpath=/lab/tree/notebooks/xeus-python.ipynb)
6+
[![lite-badge](https://jupyterlite.rtfd.io/en/latest/_static/badge.svg)](https://jupyter-xeus.github.io/xeus-python/)
67
[![Zulip](https://img.shields.io/badge/social_chat-zulip-blue.svg)](https://jupyter.zulipchat.com)
78

89
`xeus-python` is a Jupyter kernel for Python based on the native implementation of the Jupyter protocol [xeus](https://github.com/jupyter-xeus/xeus).

environment-wasm-build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ dependencies:
99
- python=3.13
1010
- yarn
1111
- click
12+
# JupyterLite
13+
- jupyterlite-core
14+
- jupyter_server
15+
- jupyterlite-xeus

environment-wasm-host.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ dependencies:
77
- pybind11 <3
88
- jedi
99
- nlohmann_json
10+
- nlohmann_json-abi
1011
- pybind11_json
1112
- numpy
1213
- xeus-lite

0 commit comments

Comments
 (0)