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

Test tutorials #399

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ jobs:
version: "0.5.7"
python-version: "3.12"

- name: Install pandoc
uses: pandoc/actions/setup@v1

- name: Install dependencies
run: uv sync

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install pandoc
uses: pandoc/actions/setup@v1

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/publish-on-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,50 @@ on:
- v[0-9]+.[0-9]+.[0-9]+*

jobs:
build-docs:
runs-on: ubuntu-latest
if: github.repository == 'stfc/janus-core' && startsWith(github.ref, 'refs/tags/v')
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true

steps:
- uses: actions/checkout@v4

- name: Install pandoc
uses: pandoc/actions/setup@v1

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "0.5.7"
python-version: "3.12"

- name: Install dependencies
run: uv sync --all-extras

- name: Build docs with tutorials
run: cd docs && uv run make all

- name: Upload
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: './docs/build/html/.'

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

publish:
needs: build-docs
runs-on: ubuntu-latest
if: github.repository == 'stfc/janus-core' && startsWith(github.ref, 'refs/tags/v')
environment:
Expand Down
8 changes: 6 additions & 2 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,20 @@ I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
customdefault:
$(SPHINXBUILD) -b html -nW --keep-going $(ALLSPHINXOPTS) $(BUILDDIR)/html

all: html
all: tutorials

clean:
rm -rf $(BUILDDIR)

html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html -D nbsphinx_execute=never
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

tutorials:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

view:
xdg-open $(BUILDDIR)/html/index.html
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"sphinxcontrib.contentui",
"sphinx_copybutton",
"sphinx_autodoc_typehints",
"nbsphinx",
]

always_use_bars_union = True
Expand Down
18 changes: 17 additions & 1 deletion docs/source/developer_guide/get_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ The full set of `ruff rules <https://docs.astral.sh/ruff/rules/>`_ are specified
Building the documentation
++++++++++++++++++++++++++

Packages in the ``docs`` dependency group install `Sphinx <https://www.sphinx-doc.org>`_ and other packages required to build ``janus-core``'s documentation.
Packages in the ``docs`` dependency group install `Sphinx <https://www.sphinx-doc.org>`_
and other Python packages required to build ``janus-core``'s documentation.

It is also necessary to `install pandoc <https://pandoc.org/installing.html>`_ on your system.

Individual individual documentation pages can be edited directly::

Expand Down Expand Up @@ -143,6 +146,19 @@ To document a new module, a new block must be added. For example, for the ``janu
make clean; make html


Notebook tutorials
++++++++++++++++++

Jupyter notebooks in ``docs/source/tutorials`` are automatically run by ``Sphinx`` using the
`nbsphinx <https://nbsphinx.readthedocs.io/en/0.2.15/index.html>`_ extension, creating the :doc:`Tutorials </tutorials/index>`.


These are tested before ``janus-core`` is published to PyPI, but can be tested locally by running::

cd docs
make clean; make tutorials


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add a paragraph with the google colab shortcuts... they are in the readme of the old repo, may need to be updated to match

Continuous integration
++++++++++++++++++++++

Expand Down
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Welcome to janus-core's documentation!

getting_started/getting_started
user_guide/index
tutorials/index
developer_guide/index
API documentation <apidoc/janus_core>

Expand Down
Loading