- Some plotting packages' output (holoviews, Altair) are currently not always saved as a part of the notebook itself.
- Sharing results with collaborators takes an extra step of extracting plots and putting them together in something like pdf or html
Automatically save the output of a notebook in a common, shareable format. Figures are included, and not just matplotlib based ones! Here is a small demo
- Initialize jupyterbook in your
projectsfolder. Be in the folder above the
pip install -U jupyter-book cookiecutter sphinx myst_nb jupyter-book create projects --cookiecutter
- Type through the prompts. Example is in screenshot above
- Create some jupyter notebooks in your
- Add your newly created notebooks' names to the file
toc.ymlin the folder
- Compile jupyter code to html locally:
cd projects/my_cool_project jb build my_cool_project
- Create an empty repository
Upload the newly created folder
- Follow the section "Push an existing directory" that appears on gitlab when you create an empty project
- You may have to substitute the
git initstep with:
git init git symbolic-ref HEAD refs/heads/main
Sync to gitlab
git add * && git commit -m 'I did some work' && git push
A blue build icon should appear on gitlab and then change to a green checkmark. That means your pages are available at https://<YourUsername>.gitlab.io/<RepoName> (e.g. https://mmyros.gitlab.io/my_cool_project/)
If a green checkmark never appears, or https://.gitlab.io/RepoName does not work, edit
.gitlab-ci.yml to contain the following, then commit and push like usual.
image: python:3.7 pages: script: - mv my_cool_project/_build/html/ public/ artifacts: paths: - public workflow: rules: - if: $CI_COMMIT_REF_NAME =~ /-wip$/ # Pipelines for branch or tag names that include -wip don't run when: never - if: '$CI_PIPELINE_SOURCE == "push"'