|
1 | 1 |
|
2 | | -.. _contributing.documentation: |
3 | | - |
4 | 2 | Contributing to the Documentation |
5 | 3 | --------------------------------- |
6 | 4 |
|
7 | 5 | Documentation is important and we encourage any improvements that can be made. |
8 | 6 | If you believe the documentation is not clear please contribute a change to |
9 | 7 | improve the documentation for all users. |
10 | 8 |
|
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`. |
162 | 11 |
|
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` |
167 | 14 |
|
168 | | -The reStructuredText (rst) output of the gallery is located in |
169 | | -``docs/src/generated/gallery``. |
| 15 | +.. toctree:: |
| 16 | + :maxdepth: 1 |
| 17 | + :hidden: |
170 | 18 |
|
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 | + |
0 commit comments