Skip to content

Commit 1c1a446

Browse files
authored
Issue #1282 Split up the developers documentation (#1283)
Fixes #1282 # Description In preparation of #1192 the developer documentation has been split up in several subsections. This makes it easier for the user to find the information they need. Furthermore it helps clarify where new documentation should be added. This PR only moves already existing documentation around. No documentation has been altered. Some references to unused links have been removed # Checklist <!--- Before requesting review, please go through this checklist: --> - [x] Links to correct issue - [ ] Update changelog, if changes affect users - [x] PR title starts with ``Issue #nr``, e.g. ``Issue #737`` - [ ] Unit tests were added - [ ] **If feature added**: Added/extended example
1 parent 0dc5d69 commit 1c1a446

File tree

8 files changed

+225
-219
lines changed

8 files changed

+225
-219
lines changed

docs/developing.rst

Lines changed: 0 additions & 218 deletions
This file was deleted.

docs/developing/ci.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Debugging Continuous Integration
2+
--------------------------------
3+
4+
The commands run during the Continuous Integration are they same as the tasks defined
5+
in the pixi tasks list. For example if the MyPy step fails you can locally run the command:
6+
7+
.. code-block:: console
8+
9+
pixi run --environment default mypy_lint
10+
11+
Or if the Unit tests are failing you can run:
12+
13+
.. code-block:: console
14+
15+
pixi run --environment default unittests
16+
17+
To full lists of tasks can be found in the pixi.toml file or can be found by running
18+
19+
.. code-block:: console
20+
21+
pixi task list

docs/developing/contributing.rst

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
Contributing Code
2+
-----------------
3+
4+
Version control
5+
~~~~~~~~~~~~~~~
6+
7+
We use Git for version control. Git is excellent software, but it might
8+
take some time to wrap your head around it. There are many excellent
9+
resources online. Have a look at `the extensive manual online`_, a
10+
shorter `handbook`_, searchable `GitHub help`_, a `cheatsheet`_, or try
11+
this `interactive tutorial`_.
12+
13+
Code style
14+
~~~~~~~~~~
15+
16+
We use `ruff`_ for automatic code formatting. Like *ruff*, we are
17+
uncompromising about formatting. Continuous Integration **will fail** if
18+
running ``ruff .`` from within the repository root folder would make
19+
any formatting changes.
20+
21+
Integration ruff into your workflow is easy. Find the instructions
22+
`here`_. If you're using VisualStudioCode (which we heartily recommend),
23+
consider enabling the `Format On Save`_ option -- it'll save a lot of
24+
hassle.
25+
26+
Automated testing
27+
~~~~~~~~~~~~~~~~~
28+
29+
If you add functionality or fix a bug, always add a test. For a new
30+
feature, you're testing anyway to see if it works... you might as well
31+
clean it up and include it in the test suite! In case of a bug, it means
32+
our test coverage is insufficient. Apart from fixing the bug, also
33+
include a test that addresses the bug so it can't happen again in the
34+
future.
35+
36+
We use ``pytest`` to do automated testing. You can run the test suite
37+
locally by simply calling ``pytest`` in the project directory.
38+
``pytest`` will pick up on all tests and run them automatically. Check
39+
the `pytest documentation`_, and have a look at the test suite to figure
40+
out how it works.
41+
42+
43+
Code review
44+
~~~~~~~~~~~
45+
46+
Create a branch, and send a merge or pull request. Your code doesn't have to be
47+
perfect! We'll have a look, and we will probably suggest some modifications or
48+
ask for some clarifications.
49+
50+
.. _the extensive manual online: https://git-scm.com/doc
51+
.. _handbook: https://guides.github.com/introduction/git-handbook/
52+
.. _GitHub help: https://help.github.com/en
53+
.. _cheatsheet: https://github.github.com/training-kit/downloads/github-git-cheat-sheet/
54+
.. _interactive tutorial: https://learngitbranching.js.org/
55+
.. _here: https://docs.astral.sh/ruff/integrations/
56+
.. _Format On Save: https://code.visualstudio.com/updates/v1_6#_format-on-save
57+
.. _pytest documentation: https://docs.pytest.org/en/latest/
58+
.. _ruff: https://github.com/astral-sh/ruff

docs/developing/documentation.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Building documentation and examples
2+
-----------------------------------
3+
4+
In the ``docs`` directory, run:
5+
6+
.. code-block:: console
7+
8+
make html
9+
10+
On Windows:
11+
12+
.. code-block:: console
13+
14+
.\make.bat html
15+
16+
Sphinx will build the documentation in a few steps. This is generally useful,
17+
as it means only part of the documentation needs to be rebuilt after some
18+
changes. However, to start afresh, run:
19+
20+
.. code-block:: console
21+
22+
python clean.py
23+
24+
This will get rid of all files generated by Sphinx.
25+
26+
Creating the docs can also be done using pixi. Run the following command to build it:
27+
28+
.. code-block:: console
29+
30+
pixi run --environment default docs

docs/developing/examples.rst

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
Developing examples
2+
-------------------
3+
4+
All our examples are available as:
5+
6+
* As a rendered HTML gallery online
7+
* As downloadable Python scripts or Jupyter notebooks
8+
* As the original Python scripts in the ``./examples`` directory, which can be
9+
browsed directly on the online repository.
10+
11+
We use `Sphinx-Gallery`_ to render the Python files as HTML. We could also use
12+
Jupyter notebooks as they are nicely rendered and executable by a user.
13+
However, Sphinx-Gallery has a number of advantages over Jupyter notebooks:
14+
15+
* To render Jupyter notebooks online, cell output has to be stored in the
16+
notebooks. This is fine for text output, but images are stored as (inline)
17+
binary blobs. These result in large commits bloating the Git repository.
18+
Tools such as `nbstripout`_ will remove the cell outputs, but this comes at
19+
the obvious cost of not having the rendered notebooks available online.
20+
* `Not everybody likes Jupyter notebooks`_ and Jupyter notebooks require
21+
special software to run. Python scripts can be run with just a Python
22+
interpreter. Furthermore, Sphinx-Gallery also provides Jupyter notebooks:
23+
from the Python scripts it will automatically generate them.
24+
* Sphinx-Gallery uses `reStructured Text (rST)`_ rather than Markdown. rST
25+
syntax is somewhat less straightforward than `Markdown`_, but it also
26+
provides additional features such as easily linking to the API (including
27+
other projects, via `intersphinx`_).
28+
29+
For Sphinx-Gallery, rST is `embedded`_ as module docstrings at the start of a
30+
scripts and as comments in between the executable Python code. We use ``# %%``
31+
as the block splitter rather than 79 ``#``'s, as the former is recognized by
32+
editors such as Spyder and VSCode, while the latter is not. The former also
33+
introduces less visual noise into the examples when reading it as an unrendered
34+
Python script.
35+
36+
Note that documentation that includes a large portion of executable code such
37+
as the User Guide has been written as Python scripts with embedded rST as well,
38+
rather than via the use of `IPython Sphinx Directives`_.
39+
40+
.. _Sphinx-Gallery: https://sphinx-gallery.github.io/stable/index.html
41+
.. _nbstripout: https://github.com/kynan/nbstripout
42+
.. _Not everybody likes Jupyter notebooks: https://www.youtube.com/watch?v=7jiPeIFXb6U
43+
.. _reStructured Text (rST): https://en.wikipedia.org/wiki/ReStructuredText
44+
.. _Markdown: https://en.wikipedia.org/wiki/Markdown
45+
.. _intersphinx: https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html
46+
.. _embedded: https://sphinx-gallery.github.io/stable/syntax.html#embedding-rst
47+
.. _IPython Sphinx Directives: https://ipython.readthedocs.io/en/stable/sphinxext.html

0 commit comments

Comments
 (0)