Skip to content

Commit 31ee315

Browse files
author
Will Benfold
committed
Adding Alastair's how-to to RTD
1 parent 91b01be commit 31ee315

File tree

10 files changed

+279
-163
lines changed

10 files changed

+279
-163
lines changed
Lines changed: 10 additions & 162 deletions
Original file line numberDiff line numberDiff line change
@@ -1,173 +1,21 @@
11

2-
.. _contributing.documentation:
3-
42
Contributing to the Documentation
53
---------------------------------
64

75
Documentation is important and we encourage any improvements that can be made.
86
If you believe the documentation is not clear please contribute a change to
97
improve the documentation for all users.
108

11-
Any change to the Iris project whether it is a bugfix, new feature or
12-
documentation update must use the :ref:`development-workflow`.
13-
14-
15-
Requirements
16-
~~~~~~~~~~~~
17-
18-
The documentation uses specific packages that need to be present. Please see
19-
:ref:`installing_iris` for instructions.
20-
21-
22-
.. _contributing.documentation.building:
23-
24-
Building
25-
~~~~~~~~
26-
27-
This documentation was built using the latest Python version that Iris
28-
supports. For more information see :ref:`installing_iris`.
29-
30-
The build can be run from the documentation directory ``docs/src``.
31-
32-
The build output for the html is found in the ``_build/html`` sub directory.
33-
When updating the documentation ensure the html build has *no errors* or
34-
*warnings* otherwise it may fail the automated `cirrus-ci`_ build.
35-
36-
Once the build is complete, if it is rerun it will only rebuild the impacted
37-
build artefacts so should take less time.
38-
39-
There is an option to perform a build but skip the
40-
:ref:`contributing.documentation.gallery` creation completely. This can be
41-
achieved via::
42-
43-
make html-noplot
44-
45-
Another option is to skip the :ref:`iris` documentation creation. This can be
46-
useful as it reduces the time to build the documentation, however you may have
47-
some build warnings as there maybe references to the API documentation.
48-
This can be achieved via::
49-
50-
make html-noapi
51-
52-
You can combine both the above and skip the
53-
:ref:`contributing.documentation.gallery` and :ref:`iris` documentation
54-
completely. This can be achieved via::
55-
56-
make html-quick
57-
58-
If you wish to run a full clean build you can run::
59-
60-
make clean
61-
make html
62-
63-
This is useful for a final test before committing your changes.
64-
65-
.. note:: In order to preserve a clean build for the html, all **warnings**
66-
have been promoted to be **errors** to ensure they are addressed.
67-
This **only** applies when ``make html`` is run.
68-
69-
.. _cirrus-ci: https://cirrus-ci.com/github/SciTools/iris
70-
71-
.. _contributing.documentation.testing:
72-
73-
Testing
74-
~~~~~~~
75-
76-
There are a ways to test various aspects of the documentation. The
77-
``make`` commands shown below can be run in the ``docs`` or
78-
``docs/src`` directory.
79-
80-
Each :ref:`contributing.documentation.gallery` entry has a corresponding test.
81-
To run the tests::
82-
83-
make gallerytest
84-
85-
Many documentation pages includes python code itself that can be run to ensure
86-
it is still valid or to demonstrate examples. To ensure these tests pass
87-
run::
88-
89-
make doctest
90-
91-
See :data:`iris.cube.Cube.data` for an example of using the `doctest`_
92-
approach.
93-
94-
.. _doctest: http://www.sphinx-doc.org/en/stable/ext/doctest.html
95-
96-
The hyperlinks in the documentation can be checked automatically.
97-
If there is a link that is known to work it can be excluded from the checks by
98-
adding it to the ``linkcheck_ignore`` array that is defined in the
99-
`conf.py`_. The hyperlink check can be run via::
100-
101-
make linkcheck
102-
103-
If this fails check the output for the text **broken** and then correct
104-
or ignore the url.
105-
106-
.. comment
107-
Finally, the spelling in the documentation can be checked automatically via the
108-
command::
109-
110-
make spelling
111-
112-
The spelling check may pull up many technical abbreviations and acronyms. This
113-
can be managed by using an **allow** list in the form of a file. This file,
114-
or list of files is set in the `conf.py`_ using the string list
115-
``spelling_word_list_filename``.
116-
117-
118-
.. note:: In addition to the automated `cirrus-ci`_ build of all the
119-
documentation build options above, the
120-
https://readthedocs.org/ service is also used. The configuration
121-
of this held in a file in the root of the
122-
`github Iris project <https://github.com/SciTools/iris>`_ named
123-
``.readthedocs.yml``.
124-
125-
126-
.. _conf.py: https://github.com/SciTools/iris/blob/main/docs/src/conf.py
127-
128-
129-
.. _contributing.documentation.api:
130-
131-
Generating API Documentation
132-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
133-
134-
In order to auto generate the API documentation based upon the docstrings a
135-
custom set of python scripts are used, these are located in the directory
136-
``docs/src/sphinxext``. Once the ``make html`` command has been run,
137-
the output of these scripts can be found in
138-
``docs/src/generated/api``.
139-
140-
If there is a particularly troublesome module that breaks the ``make html`` you
141-
can exclude the module from the API documentation. Add the entry to the
142-
``exclude_modules`` tuple list in the
143-
``docs/src/sphinxext/generate_package_rst.py`` file.
144-
145-
146-
.. _contributing.documentation.gallery:
147-
148-
Gallery
149-
~~~~~~~
150-
151-
The Iris :ref:`sphx_glr_generated_gallery` uses a sphinx extension named
152-
`sphinx-gallery <https://sphinx-gallery.github.io/stable/>`_
153-
that auto generates reStructuredText (rst) files based upon a gallery source
154-
directory that abides directory and filename convention.
155-
156-
The code for the gallery entries are in ``docs/gallery_code``.
157-
Each sub directory in this directory is a sub section of the gallery. The
158-
respective ``README.rst`` in each folder is included in the gallery output.
159-
160-
For each gallery entry there must be a corresponding test script located in
161-
``docs/gallery_tests``.
9+
If you're confident diving right in, please head for
10+
:ref:`contributing.documentation`.
16211

163-
To add an entry to the gallery simple place your python code into the
164-
appropriate sub directory and name it with a prefix of ``plot_``. If your
165-
gallery entry does not fit into any existing sub directories then create a new
166-
directory and place it in there.
12+
If you're not then we've got a step-by-step guide here to walk you through it:
13+
:ref:`contributing.documentation_easy`
16714

168-
The reStructuredText (rst) output of the gallery is located in
169-
``docs/src/generated/gallery``.
15+
.. toctree::
16+
:maxdepth: 1
17+
:hidden:
17018

171-
For more information on the directory structure and options please see the
172-
`sphinx-gallery getting started
173-
<https://sphinx-gallery.github.io/stable/getting_started.html>`_ documentation.
19+
contributing_documentation_easy
20+
contributing_documentation_full
21+
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
2+
.. _contributing.documentation_easy:
3+
4+
Contributing to the Documentation (the easy way)
5+
------------------------------------------------
6+
7+
Documentation is important and we encourage any improvements that can be made.
8+
If you believe the documentation is not clear please contribute a change to
9+
improve the documentation for all users.
10+
11+
The guide below is designed to be accessible to those with little-to-no
12+
knowledge of programming and GitHub. If you find that something doesn't work as
13+
described or could use more explanation then please let us know (or contribute
14+
the improvement yourself)!
15+
16+
First time only steps
17+
^^^^^^^^^^^^^^^^^^^^^
18+
19+
1. Create a `GitHub <https://github.com/>`_ account.
20+
21+
2. Complete the Scitools Contributor License Agreement (`link to Google Form
22+
<https://docs.google.com/forms/d/e/1FAIpQLSfd0tdE-DcJOXh8ej_7T93IizwJFYBFyRWYQOi2A8QRaKwykA/viewform>`_).
23+
This is a one-off requirement for anyone who wishes to contribute to a
24+
Scitools repository - including the documentation.
25+
26+
Steps to complete each time you propose changes
27+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
28+
29+
1. Navigate to documentation page that you want to edit (on this site).
30+
31+
2. Click the 'Edit on GitHub' button at the top right of the page.
32+
33+
.. image:: edit_on_github.png
34+
35+
3. In the resulting GitHub page select **main** from the drop-down menu near
36+
the top left of the page (to the left of the 'iris / docs / src / …' links)
37+
if it isn't already. This changes the branch to main.
38+
39+
.. image:: find_main.png
40+
41+
4. Click the pencil symbol near the top right (to the right of the 'Raw' and
42+
'Blame' buttons).
43+
44+
.. image:: edit_button.png
45+
46+
5. Make your edits! Try to strike a balance between informing the audience
47+
enough that they understand and overwhelming them with information.
48+
49+
.. note::
50+
51+
You may see the following message at the top of the edit page, informing you
52+
that GitHub has created you your own 'fork' (or copy) of the project as a
53+
precursor to allowing you to edit the page. Your changes will be merged into
54+
the main version of the documentation later.
55+
56+
.. image:: fork_banner.png
57+
58+
6. Scroll to the bottom of the edit page and enter some appropriate information
59+
in the two boxes under 'Propose changes'. You can just keep the default text
60+
if you like or enter something more specific - a short sentence explaining
61+
what's changed is fine. Then click the 'Propose changes' button.
62+
63+
.. image:: propose_changes.png
64+
65+
7. In the resulting page titled 'Pull Request', write a brief description of
66+
what you've changed underneath the following three lines:
67+
68+
.. code::
69+
70+
### Description
71+
<!-- Provide a clear description about your awesome pull request -->
72+
<!-- Tell us all about your new feature, improvement, or bug fix -->
73+
74+
Describing what you've changed and why will help the person who reviews your changes.
75+
76+
.. image:: pull_request.png
77+
78+
8. Click the 'Create pull request' button.
79+
80+
What happens next?
81+
^^^^^^^^^^^^^^^^^^
82+
83+
Someone else who works on Iris will review your changes (this happens for
84+
everyone who makes changes to Iris or its documentation). The reviewer might
85+
make comments or ask questions (don't worry about missing these, GitHub will
86+
email you to let you know). You can respond to these comments underneath where
87+
they appear in GitHub.
88+
89+
Once you've worked everything out together, the reviewer will merge your changes
90+
into the main version of the documentation so that they're accessible for
91+
everyone to benefit from.
92+
93+
**You've now contributed to the Iris documentation!** If you've caught the bug
94+
and want to get more involved (or you're just interested what that would mean)
95+
then chat to the person reviewing your code or another Iris developer.

0 commit comments

Comments
 (0)