@@ -16,13 +16,18 @@ key. To keep documentation up to date with rapdily evolving code:
16
16
- Support contributions from both inside and outside of the development team
17
17
- Perform periodic reviews
18
18
19
+ Understanding Documentation Sources
20
+ ------------------------------------
19
21
The generation of PyAnsys documentation uses `Sphinx <https://www.sphinx-doc.org/en/master/ >`__
20
22
and an Ansys-branded theme (`pyansys-sphinx-theme <https://github.com/pyansys/pyansys-sphinx-theme >`_)
21
- to assemble content that comes from docstrings, reStructuredText (RST) files, and Python (PY)
22
- example files.
23
+ to assemble content in:
24
+
25
+ - Docstrings
26
+ - reStructuredText (RST) files
27
+ - Python (PY) example files
23
28
24
29
Docstrings
25
- ----------
30
+ ~~~~~~~~~~
26
31
Docstrings must be formatted so that Sphinx can parse them. You can use either of these
27
32
Sphinx extensions:
28
33
@@ -46,9 +51,9 @@ recommend the use of numpy-style docstrings so that there is consistency
46
51
across PyAnsys libraries. For more information, see :ref: `api_documentation `.
47
52
48
53
RST Files
49
- ---------
54
+ ~~~~~~~~~
50
55
To provide general usage information in your documentation, use your favorite editor to
51
- create RST files that you then place in the repository's ``doc/ `` directory. The ``index.rst ``
56
+ create RST files that you then place in the repository's ``doc `` directory. The ``index.rst ``
52
57
file in the ``doc\source `` directory defines the first level of your documentation hierarchy.
53
58
The ``toctree `` directive indicates the maximum number of heading levels that the documentation
54
59
is to display. Below this directive are the directory names for your documentation sections.
80
85
81
86
Within RST files, heading titles are followed by a line having a string of characters that is
82
87
the same length as the heading title. If the length of the characters
83
- under the heading title do not match the length of the heading title, Sphinx will generate a warning.
88
+ under the heading title do not match the length of the heading title, Sphinx generates a warning.
84
89
85
90
For consistency within PyAnsys libraries, the use of these special characters is recommended for
86
91
headings but are not enforced:
@@ -97,7 +102,7 @@ its HTML pages and then explore the RST files in its repository. This will help
97
102
the syntax and see how RST files have been nested to create this guide.
98
103
99
104
Examples
100
- --------
105
+ ~~~~~~~~
101
106
Examples come in two formats:
102
107
103
108
- Basic code snippets demonstrating some functionality
@@ -109,11 +114,9 @@ repository. All of these examples, which should be PEP 8-compliant, are compiled
109
114
during the build process. Always ensure that your examples run properly locally because
110
115
they will be verified through the CI performed via GitHub Actions.
111
116
112
- Adding a New Example
113
- ~~~~~~~~~~~~~~~~~~~~
114
- Adding a standalone example consists of placing it in an applicable subfolder in the ``examples ``
117
+ Adding a new standalone example consists of placing it in an applicable subdirectory in the ``examples ``
115
118
directory. If none of the existing directories match the category of your example, create
116
- a new subfolder with a ``README.txt `` file describing the new category. Because these examples
119
+ a new subdirectory with a ``README.txt `` file describing the new category. Because these examples
117
120
are built using the `Sphinx-Gallery <https://sphinx-gallery.github.io/stable/index.html >`_
118
121
extension, you must follow its `coding guidelines <https://sphinx-gallery.github.io/stable/index.html >`_.
119
122
@@ -124,100 +127,37 @@ Accessing a Library's Documentation
124
127
Documentation for the latest stable release of a PyAnsys library is accessible
125
128
from its repository. You can generally access the latest development version of the
126
129
documentation tracking the ``main `` branch by adding the prefix ``dev. `` to
127
- the URL for the latest stable release. For example, consider PyAEDT documentation.
130
+ the URL for the latest stable release.
131
+
132
+ For example, consider PyAEDT documentation:
128
133
129
134
- The URL for documentation of the latest stable release is `<https://aedtdocs.pyansys.com/ >`_.
130
135
- The URL for documentation of the lastest development version is `<https://dev.aedtdocs.pyansys.com/ >`_.
131
136
132
137
The latest development versions of both the library and its documentation are automatically kept
133
138
up-to-date via GitHub actions.
134
139
135
- .. _doc_building :
136
-
137
- Building Documentation Locally
138
- ------------------------------
139
- You can build and verify the HTML documentation for a PyAnsys library locally
140
- by installing Sphinx and other documentation build dependencies.
141
-
142
- Setting Up Your Machine
143
- ~~~~~~~~~~~~~~~~~~~~~~~
144
- Anaconda provides Python and tools, such as a Python IDE (Interactive Development Environment),
145
- a Python command line editor, and Sphinx dependencies. This gives you what you need to get up
146
- and running.
147
-
148
- #. Install the `Anaconda individual edition <https://www.anaconda.com/products/individual >`_.
149
-
150
- #. If a PyAnsys library already exists, create a directory in which to place a clone of its GitHub repository.
151
-
152
- #. Clone the PyAnsys library's GitHub repository. For more information, see :ref: `cloning `.
153
-
154
- #. If you have not yet cloned the ``pyansys-sphinx-theme `` repository, clone it.
155
-
156
- Installing Build Requirements
157
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
158
- You can build documentation for the ``dev_guide `` and ``pyansys-sphinx-theme `` repositories without
159
- installing a PyAnsys library in development mode. However, when you push changes that you have made
160
- in a local branch to the GitHub repository for other PyAnsys libraries, CI checks typically require
161
- that the full library is installed.
162
-
163
- #. In Anaconda Powershell, navigate to the base directory in the library's cloned repository.
164
-
165
- #. If your library must be installed in development mode, enter:
166
-
167
- .. code ::
168
-
169
- pip install -e .
170
-
171
- #. To install the build requirements for generating documentation, enter:
172
-
173
- .. code ::
174
-
175
- pip install -r requirements_docs.txt
176
-
177
- #. If you are running on a Linux/Mac OS, to build the documentation, enter:
178
-
179
- .. code ::
140
+ To make documentation changes, you create a branch with a name that begins with a prefix of
141
+ ``doc/ `` that is then followed by a short description of what you are changing. For more
142
+ information, see :ref: `branch_naming `.
180
143
181
- make -C doc html
182
-
183
- #. If you are running on Windows, to build the documentation, enter two
184
- commands:
185
-
186
- .. code ::
187
-
188
- cd doc
189
- make.bat html
190
-
191
-
192
- As Sphinx is generating HTML output in the library's ``doc\_build\html `` folder,
193
- Anaconda Powershell displays any errors and warnings for unexpected indentations,
194
- bad target locations for links, missing files, and extra files included in the
195
- repository but not referenced by any ``index.rst `` file.
196
-
197
- #. Resolve all indicated issues before submitting a pull request (PR) to push
198
- your changes to the library's GitHub repository.
199
-
200
- #. After local documentation builds successfully, navigate to ``doc/_build/html/ ``
201
- and use your browser to open the ``index.html `` file to review the documentation,
202
- repeating the local build process until there are no errors or obvious issues.
203
-
204
- .. note ::
205
- You can use ``make.bat `` to build more than HTML output. To view a summary of
206
- all target options, enter ``make.bat ``.
207
-
208
- Your next step is to push your changes to the library's GitHub repository
209
- by creating a PR. For more information, see :ref: `create_pr `.
144
+ As you are making changes in this branch, you want to periodically generate the documentation
145
+ locally so that you can test your changes before you create a GitHub pull request. For more
146
+ information, see :ref: `doc_building `. It is also possible for you to build a PDF
147
+ of your documentation locally on Windows as described in :ref: `pdf_building `.
210
148
211
149
.. _cloning :
212
150
213
151
Cloning a GitHub Repository
214
152
---------------------------
215
- While developers likely know how to clone a GitHub repository, technical documentation
216
- specialists may not know how to do this. You can easily use either Windows PowerShell
217
- or GitBash.
153
+ Contributing to a GitHub repository requires that you first clone the repository. While developers
154
+ likely know many ways to do this, technical documentation specialists may need to review the
155
+ following instructions for using either Windows PowerShell or GitBash to clone a GitHub repository .
218
156
219
157
Using Windows PowerShell to Clone a GitHub Repository
220
158
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
159
+ To use Windows PowerShell to clone a GitHub repository:
160
+
221
161
#. In Windows PowerShell, navigate to the directory on your machine where you want
222
162
to clone GitHub repositories.
223
163
@@ -239,21 +179,22 @@ Using Windows PowerShell to Clone a GitHub Repository
239
179
240
180
#. Press ``Enter `` to copy the files in the repository to your local directory.
241
181
242
- #. Type ``ls `` to see a list of the files now in the folder for this repository
243
- in your local directory.
182
+ #. Type ``ls `` to see a list of the files now in your local directory.
244
183
245
184
.. note ::
246
185
In Anaconda Powershell, typing ``dir `` is the equivalent to typing ``ls ``.
247
186
248
187
Using GitBash to Clone a GitHub Repository
249
188
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
189
+ To use GitBash to clone a GitHub repository:
190
+
250
191
#. In the directory where you want to clone PyAnsys repositories, right-click and
251
192
select ``GitBash Here ``.
252
193
253
194
#. Type ``git clone `` followed by the address of the repo to clone.
254
195
255
- For example, to clone the `` pyansys-sphinx-theme `` repository, you would
256
- type and enter :
196
+
197
+ For example, you clone the `` pyansys-sphinx-theme `` repository with :
257
198
258
199
.. code ::
259
200
@@ -263,13 +204,11 @@ type and enter:
263
204
264
205
Pushing Changes to the GitHub Repository
265
206
----------------------------------------
266
- Once you have tested your changes in local documentation builds and are
267
- satisifed with them, you can push them to the library's GitHub repository.
268
- You can use Git commands or Git Extension to accomplish this.
269
-
270
- For documentation changes, the branch name should always have a prefix of ``doc/ ``
271
- followed by a short description of what you've changed. For more information, see
272
- :ref: `branch_naming `.
207
+ As you make changes in your ``doc/ `` branch, you want to periodically test then in
208
+ local documentation builds as described in :ref: `doc_building `. After you resolve
209
+ any issues and are satisfied with what apears in a local build, you are ready
210
+ to push your changes to the library's GitHub repository. To accomplish this,
211
+ you can use either Git commands or Git Extensions.
273
212
274
213
Using Git Commands to Push Changes
275
214
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -317,8 +256,7 @@ To use Git commands to push your changes to the GitHub repository:
317
256
followed by the branch name.
318
257
319
258
For the given example, you would enter:
320
-
321
-
259
+
322
260
.. code ::
323
261
324
262
git push --set-upstream origin doc/edit_contributing
@@ -356,6 +294,7 @@ To use Git Extensions to push your changes to the GitHub repository:
356
294
357
295
#. Create the PR as described in :ref: `create_pr `.
358
296
297
+
359
298
.. _create_pr :
360
299
361
300
Creating the GitHub PR
@@ -378,3 +317,122 @@ the GitHub PR:
378
317
379
318
If you need to change a PR title, to its right, click the ``Edit `` button,
380
319
which becomes a ``Save `` button while you are in editing mode.
320
+
321
+ .. _doc_building :
322
+
323
+ Building Documentation Locally
324
+ ------------------------------
325
+ You can build and verify the HTML documentation for a PyAnsys library locally
326
+ by installing Sphinx and other documentation build dependencies.
327
+
328
+ Setting Up Your Machine
329
+ ~~~~~~~~~~~~~~~~~~~~~~~
330
+ Anaconda provides Python and tools, such as a Python IDE (Interactive Development Environment),
331
+ a Python command line editor, and Sphinx dependencies. This gives you what you need to get up
332
+ and running.
333
+
334
+ #. Install the `Anaconda individual edition <https://www.anaconda.com/products/individual >`_.
335
+
336
+ #. If a PyAnsys library already exists, create a directory in which to place a clone of its GitHub repository.
337
+
338
+ #. Clone the PyAnsys library's GitHub repository. For more information, see :ref: `cloning `.
339
+
340
+ #. If you have not yet cloned the `pyansys-sphinx-theme <https://github.com/pyansys/pyansys-sphinx-theme >`_
341
+ repository, clone it.
342
+
343
+ Installing Build Requirements
344
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
345
+ You can build documentation for the `dev_guide <https://github.com/pyansys/dev-guide >`_
346
+ and `pyansys-sphinx-theme <https://github.com/pyansys/pyansys-sphinx-theme >`_ repositories without
347
+ installing a PyAnsys library in development mode. However, when you push changes that you have made
348
+ in a local branch to the GitHub repository for other PyAnsys libraries, CI checks typically require
349
+ that the full library is installed.
350
+
351
+ #. In Anaconda Powershell, navigate to the base directory in the library's cloned repository.
352
+
353
+ #. If your library must be installed in development mode, enter:
354
+
355
+ .. code ::
356
+
357
+ pip install -e .
358
+
359
+ #. To install the build requirements for generating documentation, enter:
360
+
361
+ .. code ::
362
+
363
+ pip install -r requirements_docs.txt
364
+
365
+ #. If you are running on a Linux/Mac OS, to build the documentation, enter:
366
+
367
+ .. code ::
368
+
369
+ make -C doc html
370
+
371
+ #. If you are running on Windows, to build the documentation, enter two
372
+ commands:
373
+
374
+ .. code ::
375
+
376
+ cd doc
377
+ .\make.bat html
378
+
379
+
380
+ As Sphinx is generating HTML output in the library's ``../doc/_build/html `` directory,
381
+ Anaconda Powershell displays any errors and warnings for unexpected indentations,
382
+ bad target locations for links, missing files, and extra files included in the
383
+ repository but not referenced by any ``index.rst `` file.
384
+
385
+ #. Resolve all indicated issues before submitting a pull request (PR) to push
386
+ your changes to the library's GitHub repository.
387
+
388
+ #. After local documentation builds successfully, navigate to ``doc/_build/html/ ``
389
+ and use your browser to open the ``index.html `` file to review the documentation,
390
+ repeating the local build process until there are no errors or obvious issues.
391
+
392
+ .. note ::
393
+ You can use ``make.bat `` to build more than HTML output. To view a summary of
394
+ all target options, enter ``make.bat ``.
395
+
396
+ Your next step is to push your changes to the library's GitHub repository
397
+ by creating a PR. For more information, see :ref: `create_pr `.
398
+
399
+ .. _pdf_building :
400
+
401
+ Building a PDF of Your Documentation Locally
402
+ --------------------------------------------
403
+ Some libraries supply a link to a PDF of the documentation under 'Assets' in the
404
+ release notes for a version. On Linux, building this PDF can be done by following
405
+ `these directions <https://sudonull.com/post/70830-How-to-make-LaTeX-and-PDF-generation-in-Sphinx >`_.
406
+ On Windows, building a PDF is a manual process that you run locally:
407
+
408
+ #. Install `MiKTeX <https://miktex.org/download >`_ for Windows, selecting the
409
+ recommended option for installing it for only your own use.
410
+ #. From the Windows Start menu, start the MiKTeX Console.
411
+ #. On the Welcome page, click ``Check for updates `` and install any available
412
+ updates.
413
+ #. Install the latest version of Strawbery Perl, which enables you to build
414
+ LaTeX files, accepting the default installation location (``C:\Strawberry\ ``).
415
+ #. In the Command Prompt window, type ``perl-v `` to test that your installation is
416
+ successful.
417
+ #. Ensure that these Perl directory locations have been added to your ``Path ``
418
+ system environment variable:
419
+
420
+ - C:/Strawberry/c/bin
421
+ - C:/Strawberry/perl/site/bin
422
+ - C:/Strawberry/perl/bin
423
+
424
+
425
+ #. In Anaconda PowerShell, navigate to the ``doc `` directory with:
426
+
427
+ .. code ::
428
+
429
+ cd C:\AnsysDev\GitRepos\PyAnsys\dev-guide\doc
430
+
431
+
432
+ #. Generate LaTeX files and a PDF from these files in ``..\doc\build\latex ``
433
+ with:
434
+
435
+ .. code ::
436
+
437
+ .\make latexpdf
438
+
0 commit comments