Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
DerThorsten committed Mar 12, 2024
1 parent ab9b596 commit 3f68e0b
Show file tree
Hide file tree
Showing 38 changed files with 666 additions and 887 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: build the docs
shell: bash -el {0}
run: |
./build_docs.sh
./build_mkdocs.sh

################################################################
Expand All @@ -47,7 +47,7 @@ jobs:
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v2
with:
path: docs/_build/html
path: docs_build/mkdocs


deploy:
Expand Down
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@ node_modules
package-lock.json
docs/_build
*.wasm
nxtgm_javascript_runtime.js
nxtgm_javascript_runtime.js
.DS_Store
xeus-python/
emsdk_*
docs_build/
empack_config.yaml
25 changes: 0 additions & 25 deletions .readthedocs.yaml

This file was deleted.

97 changes: 0 additions & 97 deletions benchmark_pyjs.py

This file was deleted.

64 changes: 0 additions & 64 deletions build_browser.sh

This file was deleted.

70 changes: 59 additions & 11 deletions build_docs.sh → build_mkdocs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if [ ! -d "$WASM_ENV_PREFIX" ]; then
--yes \
python pybind11 nlohmann_json pybind11_json numpy \
bzip2 sqlite zlib libffi exceptiongroup \
xeus xeus-lite xeus-python-shell xeus-javascript xtl
xeus xeus-lite xeus-python xeus-javascript xtl "ipython<8.20"

else
echo "Wasm env $WASM_ENV_NAME already exists"
Expand Down Expand Up @@ -69,14 +69,14 @@ fi
# if there is no xeus-python dir, clone it
if [ ! -d "$THIS_DIR/xeus-python" ]; then
cd $THIS_DIR
git clone https://github.com/jupyter-xeus/xeus-python/
git clone -b pyjs_update https://github.com/DerThorsten/xeus-python/
else
echo "xeus-python dir already exists"
fi


PYJS_PROBE_FILE=$WASM_ENV_PREFIX/share/jupyter/kernels/xpython/kernel.json
if [ ! -f "$PYJS_PROBE_FILE" ]; then
# PYJS_PROBE_FILE=$WASM_ENV_PREFIX/share/jupyter/kernels/xpython/kernel.json
if false; then
echo "Building xeus-python"

cd $THIS_DIR
Expand Down Expand Up @@ -105,26 +105,74 @@ if [ ! -f "$PYJS_PROBE_FILE" ]; then


emmake make -j8 install

rm -rf $WASM_ENV_PREFIX/share/jupyter/kernels/xpython-raw
if [ -d "$WASM_ENV_PREFIX/share/jupyter/kernels/xpython-raw" ]; then
rm -rf $WASM_ENV_PREFIX/share/jupyter/kernels/xpython-raw
fi

else
echo "Skipping build xeus-python"
fi



if true ; then

rm -rf $THIS_DIR/docs_build
mkdir -p $THIS_DIR/docs_build

# convert *.py to *.ipynb using jupytext
NOTEBOOK_OUTPUT_DIR=$THIS_DIR/docs_build/notebooks
rm -rf $NOTEBOOK_OUTPUT_DIR
mkdir -p $NOTEBOOK_OUTPUT_DIR

for f in $THIS_DIR/examples/*.py; do
# get the filename without the extension and path
filename=$(basename -- "$f")
jupytext $f --to ipynb --output $NOTEBOOK_OUTPUT_DIR/${filename%.*}.ipynb --update-metadata '{"kernelspec": {"name": "xpython"}}'
done
for f in $THIS_DIR/examples/*.js; do
# get the filename without the extension and path
filename=$(basename -- "$f")
jupytext $f --to ipynb --output $NOTEBOOK_OUTPUT_DIR/${filename%.*}.ipynb --update-metadata '{"kernelspec": {"name": "xjavascript"}}'
done



# lite
if true; then
cd $THIS_DIR
rm -rf docs_build/_output
rm -rf docs_build/.jupyterlite.doit.db
mkdir -p docs_build
cd docs_build

jupyter lite build \
--contents=$NOTEBOOK_OUTPUT_DIR \
--XeusAddon.prefix=$WASM_ENV_PREFIX \
--XeusAddon.mounts=$THIS_DIR/module/pyjs:/lib/python3.11/site-packages/pyjs
fi
fi


# the docs itself
if true ; then

export PREFIX=$MAMBA_ROOT_PREFIX/envs/pyjs-wasm
echo "Building docs"

cd $THIS_DIR/docs
cd $THIS_DIR
mkdir -p docs_build/mkdocs
export PYTHONPATH=$PYTHONPATH:$THIS_DIR/stubs
export PYTHONPATH=$PYTHONPATH:$THIS_DIR/module
mkdocs build --site-dir=docs_build/mkdocs

WASM_ENV_PREFIX=$WASM_ENV_PREFIX LITE=1 make html

# post-build

WASM_ENV_PREFIX=$WASM_ENV_PREFIX python ./post_build.py
fi

if true ; then
# # copy lite _output to docs_build
cp -r $THIS_DIR/docs_build/_output $THIS_DIR/docs_build/mkdocs/lite
# copy pyjs binary to docs_build
cp $WASM_ENV_PREFIX/lib_js/pyjs/* $THIS_DIR/docs_build/mkdocs/lite/xeus/bin/

fi
62 changes: 0 additions & 62 deletions build_tests.sh

This file was deleted.

Loading

0 comments on commit 3f68e0b

Please sign in to comment.