Skip to content

Commit 62a9194

Browse files
committed
Document gallery submodule workflow in contributing guide
Replaces the now-stale "Tutorials with myst-nb" section with concrete instructions for the submodule-based gallery: how to clone with submodules, how to bump the pin, and where to send notebook PRs (the notebooks repo). Adds a heads-up admonition to the "Building the docs locally" section so contributors who cloned without --recurse-submodules know to run `git submodule update --init --recursive` before sphinx-build.
1 parent e24d7a2 commit 62a9194

1 file changed

Lines changed: 51 additions & 8 deletions

File tree

‎docs/contributing.md‎

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ This project uses [sphinx][] with the following features:
251251

252252
- The [myst][] extension allows to write documentation in markdown/Markedly Structured Text
253253
- [Numpy-style docstrings][numpydoc] (through the [napoleon][numpydoc-napoleon] extension).
254-
- Jupyter notebooks as tutorials through [myst-nb][] (See [Tutorials with myst-nb](#tutorials-with-myst-nb-and-jupyter-notebooks))
254+
- Jupyter notebooks as tutorials through [myst-nb][] (See [Gallery notebooks (submodule)](#gallery-notebooks-submodule))
255255
- [sphinx-autodoc-typehints][], to automatically reference annotated input and output types
256256
- Citations (like {cite:p}`Virshup_2023`) can be included with [sphinxcontrib-bibtex](https://sphinxcontrib-bibtex.readthedocs.io/)
257257

@@ -264,16 +264,48 @@ See scanpy's {doc}`scanpy:dev/documentation` for more information on how to writ
264264
[numpydoc]: https://numpydoc.readthedocs.io/en/latest/format.html
265265
[sphinx-autodoc-typehints]: https://github.com/tox-dev/sphinx-autodoc-typehints
266266

267-
### Tutorials with myst-nb and jupyter notebooks
267+
### Gallery notebooks (submodule)
268268

269-
The documentation is set-up to render jupyter notebooks stored in the `docs/notebooks` directory using [myst-nb][].
270-
Currently, only notebooks in `.ipynb` format are supported that will be included with both their input and output cells.
271-
It is your responsibility to update and re-run the notebook whenever necessary.
269+
The gallery rendered into the docs lives in a separate repository,
270+
[`scverse/spatialdata-plot-notebooks`][notebooks-repo], mounted here as a git
271+
submodule at `docs/notebooks/`. This follows the scverse convention used by
272+
`anndata`, `spatialdata`, `scvi-tools`, and `squidpy`.
272273

273-
If you are interested in automatically running notebooks as part of the continuous integration,
274-
please check out [this feature request][issue-render-notebooks] in the `cookiecutter-scverse` repository.
274+
Notebooks are pre-executed by humans and committed with their outputs; the
275+
docs build performs no execution and pulls no data. A scheduled CI job in the
276+
notebooks repo re-executes every notebook against the latest
277+
`spatialdata-plot` release and fails on output drift.
275278

276-
[issue-render-notebooks]: https://github.com/scverse/cookiecutter-scverse/issues/40
279+
#### Working with the gallery locally
280+
281+
```bash
282+
# First-time clone — pull this repo with submodules
283+
git clone --recurse-submodules https://github.com/scverse/spatialdata-plot.git
284+
285+
# Already cloned without submodules — initialise after the fact
286+
git submodule update --init --recursive
287+
288+
# Pull the latest gallery content from the notebooks repo's main branch
289+
git submodule update --remote docs/notebooks
290+
```
291+
292+
ReadTheDocs is configured (`submodules: include: all` in `.readthedocs.yaml`)
293+
to fetch the submodule on every build, so PR previews always render the
294+
current pinned gallery content.
295+
296+
#### Adding or editing a notebook
297+
298+
Notebook changes are made in the [notebooks repo][notebooks-repo], not here.
299+
See its `CONTRIBUTING.md` for the workflow. After your notebook PR merges
300+
there, open a small follow-up PR in this repo bumping the submodule pin:
301+
302+
```bash
303+
git submodule update --remote docs/notebooks
304+
git add docs/notebooks
305+
git commit -m "Bump notebooks submodule"
306+
```
307+
308+
[notebooks-repo]: https://github.com/scverse/spatialdata-plot-notebooks
277309

278310
#### Hints
279311

@@ -286,6 +318,17 @@ please check out [this feature request][issue-render-notebooks] in the `cookiecu
286318

287319
### Building the docs locally
288320

321+
:::{important}
322+
The docs include a git submodule (`docs/notebooks` → `spatialdata-plot-notebooks`).
323+
If you cloned this repo without `--recurse-submodules`, initialise it once before building:
324+
325+
```bash
326+
git submodule update --init --recursive
327+
```
328+
329+
Without the submodule, the gallery pages will be missing and sphinx will warn about broken toctree entries.
330+
:::
331+
289332
:::::{tabs}
290333
::::{group-tab} Hatch
291334

0 commit comments

Comments
 (0)