Skip to content

Commit 8720994

Browse files
authored
doc/refactor_doc_practices (#33)
* doc/refactor_doc_practices * Incorporated review comments from greschd * Promote use of "Create draft pull request" rather than adding WIP to PR title
1 parent 95e8c37 commit 8720994

File tree

4 files changed

+359
-77
lines changed

4 files changed

+359
-77
lines changed

doc/source/documentation_style/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.. _api_documentation:
22

3-
Documentation Style
4-
###################
5-
Good documentation drives library adoption and usage and is the
3+
API Documentation Style
4+
#######################
5+
Good API documentation drives library adoption and usage and is the
66
foundation for a good developer experience. Even with the best
77
interfaces and the most functional product, no one will adopt the API
88
if they don't know how to use it or if they aren't satisfied with the

doc/source/guidelines/dev_practices.rst

Lines changed: 9 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -126,87 +126,22 @@ like this:
126126

127127
Documentation
128128
-------------
129-
The source and content for documentation varies from repository to repository. For a PyAnsys library,
130-
documentation is generated from three sources:
129+
Good documentation is essential to Python community members adopting PyAnsys libraries.
130+
While the source and content for each library's documentation differs, the documentation
131+
itself is generated from three sources:
131132

132133
- Docstrings from the library's classes, functions, and modules using
133134
`sphinx.ext.autodoc <https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html>`_.
134135
- reStructuredText (RST) files from ``doc/``
135136
- Examples from ``examples/``
136137

137-
General usage information and API descriptions should be placed within
138-
``doc/source`` and docstrings. Full examples should be placed in
139-
``examples/``.
138+
Docstrings are included in the Python (PY) files for your API. General usage information
139+
is provided in RST files that are placed in ``doc/source``. Full-fledged standalone examples
140+
that are meant to be run as individual downloadable scripts are provided in PY files that are
141+
placed in ``examples/``.
140142

141-
Adding a New Example
142-
~~~~~~~~~~~~~~~~~~~~
143-
Examples come in two formats:
144-
145-
- Basic code snippets demonstrating some functionality
146-
- Full-fledged standalone examples meant to be run as individual downloadable scripts
147-
148-
While basic code snippets should be placed in the ``doc/source`` directory, full-fledged
149-
standalone examples must be placed in the ``examples`` directory at the root of the repository.
150-
151-
When adding a standalone example, you add it to an applicable subfolder in the ``examples``
152-
directory. If none of the existing directories match the category of your example, create
153-
a new subfolder with a ``README.txt`` file describing the new category. As these examples
154-
are built using the Sphinx gallery extension, you must follow `Sphinx gallery coding guidelines <https://sphinx-gallery.github.io/stable/index.html>_`.
155-
156-
PyMAPDL provides a self-demonstrating example of how to `add an example reference key <https://mapdldocs.pyansys.com/examples/03-tips-n-tricks/00-example-template.html#ref-how-to-add-an-example-reference-key>`_.
157-
158-
Documentation Style and Organization
159-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
160-
Docstrings should follow `numpydocs docstring <https://numpydoc.readthedocs.io/en/latest/format.html>`_
161-
guidelines. Documentation within the ``doc/`` directory use the reStructuredText.
162-
(RST) format. Examples within the ``examples/`` directory should be PEP 8-compliant
163-
and will be compiled dynamically during the build process. Always ensure that
164-
examples run properly locally because they will be verified through the CI performed
165-
via GitHub Actions.
166-
167-
Documentation for the latest stable release of a PyAnsys library is accessible
168-
from its repository. You can generally access the latest development version of the
169-
documentation tracking the ``main`` branch by adding the prefix ``dev.`` to
170-
the URL for the latest stable release. For example, the URL for documentation of the
171-
latest stable release of PyAEDT is `<https://aedtdocs.pyansys.com/>`_, and
172-
the URL for the latest documentation for the development version of PyAEDT is
173-
`<https://dev.aedtdocs.pyansys.com/>`_. The latest development versions of both
174-
the library and its documentation are kept up-to-date automatically via GitHub actions.
175-
176-
Building Documentation Locally
177-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
178-
You can build and verify the HTML documentation for a PyAnsys project locally
179-
by installing Sphinx and other documentation build dependencies.
180-
181-
#. Optionally install the project in development mode:
182-
183-
.. code::
184-
185-
pip install -e .
186-
187-
#. Install the build requirements for documentation:
188-
189-
.. code::
190-
191-
pip install -r requirements_docs.txt
192-
193-
194-
#. If running on Linux/Mac OS, build the documentation:
195-
196-
.. code::
197-
198-
make -C doc html
199-
200-
Otherwise, if running on Windows, build the documentation:
201-
202-
.. code::
203-
204-
cd doc
205-
make.bat html
206-
207-
#. After documentation builds successfully locally, navigate to
208-
``doc/_build/html/`` and use your browser to open the
209-
``index.html`` so that you can review the documenation.
143+
For comprehensive documentation guidelines, including how to build documentation locally,
144+
see :ref:`doc_practices`.
210145

211146
Continuous Integration and Continuous Delivery (CI/CD)
212147
------------------------------------------------------

0 commit comments

Comments
 (0)