You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/dev/documentation.md
+26-20Lines changed: 26 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,38 +4,37 @@
4
4
5
5
## Building the docs
6
6
7
-
Dependencies for building the documentation for scanpy can be installed with `pip install -e "scanpy[doc]"`
8
-
9
-
To build the docs, enter the `docs` directory and run `make html`. After this process completes you can take a look at the docs by opening `scanpy/docs/_build/html/index.html`.
7
+
To build the docs, run `hatch run docs:build`.
8
+
Afterwards, you can run `hatch run docs:open` to open {file}`docs/_build/html/index.html`.
10
9
11
10
Your browser and Sphinx cache docs which have been built previously.
12
11
Sometimes these caches are not invalidated when you've updated the docs.
13
12
If docs are not updating the way you expect, first try "force reloading" your browser page – e.g. reload the page without using the cache.
14
-
Next, if problems persist, clear the sphinx cache and try building them again (`make clean` from `docs` directory).
15
-
16
-
```{note}
17
-
If you've cloned the repository pre 1.8.0, you may need to be more thorough in cleaning.
18
-
If you run into warnings try removing all untracked files in the docs directory.
19
-
```
13
+
Next, if problems persist, clear the sphinx cache (`hatch run docs:clean`) and try building them again.
20
14
21
15
## Adding to the docs
22
16
23
-
For any user-visible changes, please make sure a note has been added to the release notes for the relevant version so we can credit you!
24
-
These files are found in the `docs/release-notes/` directory.
17
+
For any user-visible changes, please make sure a note has been added to the release notes using [`hatch run towncrier:create`][towncrier create].
25
18
We recommend waiting on this until your PR is close to done since this can often causes merge conflicts.
26
19
27
20
Once you've added a new function to the documentation, you'll need to make sure there is a link somewhere in the documentation site pointing to it.
28
21
This should be added to `docs/api.md` under a relevant heading.
29
22
30
-
For tutorials and more in depth examples, consider adding a notebook to [scanpy-tutorials](https://github.com/scverse/scanpy-tutorials/).
23
+
For tutorials and more in depth examples, consider adding a notebook to the [scanpy-tutorials][] repository.
31
24
32
-
The tutorials are tied to this repository via a submodule. To update the submodule, run `git submodule update --remote` from the root of the repository. Subsequently, commit and push the changes in a PR. This should be done before each release to ensure the tutorials are up to date.
25
+
The tutorials are tied to this repository via a submodule.
26
+
To update the submodule, run `git submodule update --remote` from the root of the repository.
27
+
Subsequently, commit and push the changes in a PR.
28
+
This should be done before each release to ensure the tutorials are up to date.
We'd primarily suggest looking at existing docstrings for examples, but the [napolean guide to numpy style docstrings](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html#example-numpy) is also a great source.
38
-
If you're unfamiliar with the reStructuredText (`rst`) markup format, [Sphinx has a useful primer](https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html).
36
+
We'd primarily suggest looking at existing docstrings for examples, but the [napolean guide to numpy style docstrings][] is also a great source.
37
+
If you're unfamiliar with the reStructuredText (rST) markup format, check out the [Sphinx rST primer][].
39
38
40
39
Some key points:
41
40
@@ -46,26 +45,34 @@ Some key points:
46
45
47
46
Look at [sc.tl.louvain](https://github.com/scverse/scanpy/blob/a811fee0ef44fcaecbde0cad6336336bce649484/scanpy/tools/_louvain.py#L22-L90) as an example for everything mentioned here.
48
47
48
+
[napolean guide to numpy style docstrings]: https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html#example-numpy
One of the most useful things you can include in a docstring is examples of how the function should be used.
52
54
These are a great way to demonstrate intended usage and give users a template they can copy and modify.
53
-
We're able to include the plots produced by these snippets in the rendered docs using [matplotlib's plot directive](https://matplotlib.org/devel/plot_directive.html).
55
+
We're able to include the plots produced by these snippets in the rendered docs using [matplotlib's plot directive][].
54
56
For examples of this, see the `Examples` sections of {func}`~scanpy.pl.dotplot` or {func}`~scanpy.pp.calculate_qc_metrics`.
55
57
56
58
Note that anything in these sections will need to be run when the docs are built, so please keep them computationally light.
57
59
58
60
- If you need computed features (e.g. an embedding, differential expression results) load data that has this precomputed.
59
61
- Try to re-use datasets, this reduces the amount of data that needs to be downloaded to the CI server.
The `Params` abbreviation is a legit replacement for `Parameters`.
64
68
65
69
To document parameter types use type annotations on function parameters.
66
70
These will automatically populate the docstrings on import, and when the documentation is built.
67
71
68
-
Use the python standard library types (defined in [collections.abc](https://docs.python.org/3/library/collections.abc.html) and [typing](https://docs.python.org/3/library/typing.html) modules) for containers, e.g. `Sequence`s (like `list`), `Iterable`s (like `set`), and `Mapping`s (like `dict`).
72
+
Use the python standard library types (defined in {mod}`collections.abc` and {mod}`typing` modules) for containers, e.g.
0 commit comments