Skip to content

Commit d99348e

Browse files
committed
Fix links and cross-references
1 parent 9732ea1 commit d99348e

20 files changed

+350
-328
lines changed

doc/source/abstractions/app-interface.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,9 @@ the model setup object. There's no reason why a user needs direct
106106
access to ``_omodelsetup``, which is why it's protected in the
107107
``Hfss`` class. Additionally, calling the method is simplified by
108108
providing (and documenting) the defaults using keyword arguments and
109-
placing them into the ``vars`` list, all while following the `Style
110-
Guide for Python Code (PEP8)`_.
109+
placing them into the ``vars`` list, all while following the Style
110+
Guide for Python Code, defined in `PEP 8`_.
111111

112-
.. _PyAEDT: https://github.com/pyansys/pyaedt
113-
.. _Style Guide for Python Code (PEP8): https://www.python.org/dev/peps/pep-0008
112+
113+
.. LINKS AND REFERENCES
114+
.. include:: ../links.rst

doc/source/abstractions/data-transfer.rst

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ Data Transfer
33

44
Abstracted APIs should attempt to hide the implementation details of
55
the remote or local API in a well organized data model. This data
6-
model should avoid returning raw JSON files, gRPC messages, SWIG objects,
6+
model should avoid returning raw JSON files, gRPC messages, `SWIG`_ objects,
77
or .NET objects. It should preferably return standard Python objects
8-
like lists, strings, dictionaries when useful, and `NumPy <https://numpy.org/>`_
9-
arrays or `pandas <https://pandas.pydata.org/>`_ dataframes for more complex data.
8+
like lists, strings, dictionaries when useful, and `NumPy`_
9+
arrays or `pandas`_ dataframes for more complex data.
1010

1111
For example, consider a simple mesh in MAPDL:
1212

@@ -109,16 +109,5 @@ interface that can efficiently exchange a wide variety of data formats and
109109
messages.
110110

111111

112-
.. _gRPC: https://grpc.io/
113-
.. _pythoncom: http://timgolden.me.uk/pywin32-docs/pythoncom.html
114-
.. _SWIG: http://www.swig.org/
115-
.. _C extensions: https://docs.python.org/3/extending/extending.html
116-
.. _Anaconda Distribution: https://www.anaconda.com/products/individual
117-
.. _REST: https://en.wikipedia.org/wiki/Representational_state_transfer
118-
.. _PyAEDT: https://github.com/pyansys/PyAEDT
119-
.. _PyMAPDL: https://github.com/pyansys/pymapdl
120-
.. _pymapdl: https://github.com/pyansys/pymapdl
121-
.. _Style Guide for Python Code (PEP8): https://www.python.org/dev/peps/pep-0008
122-
.. _grpc_chunk_stream_demo: https://github.com/pyansys/grpc_chunk_stream_demo
123-
.. _numpydoc: https://numpydoc.readthedocs.io/en/latest/format.html
124-
.. _Namespace Packages: https://packaging.python.org/guides/packaging-namespace-packages/
112+
.. LINKS AND REFERENCES
113+
.. include:: ../links.rst

doc/source/abstractions/service.rst

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ the "desktop API". In this case, remote API calls should be identical
1010
if the service is local or remote, with the only difference being that local
1111
calls are faster to execute.
1212

13-
Consider the following code examples. The left-hand side shows the
14-
amount of work to start, establish a connection to, and submit an
15-
input file to MAPDL using auto-generated gRPC interface files. For
16-
more information, see `pyansys-protos-generator
17-
<https://github.com/pyansys/pyansys-protos-generator>`_. The
18-
right-hand side shows the same workflow but uses the `PyMAPDL`_ library.
13+
Consider the following code examples. The left-hand side shows the amount of
14+
work to start, establish a connection to, and submit an input file to MAPDL
15+
using auto-generated gRPC interface files. For more information, see
16+
`pyansys-protos-generator`_. The right-hand side shows the same workflow but
17+
uses the `PyMAPDL`_ library.
1918

2019
+----------------------------------------------------------+--------------------------------------------+
2120
| Using the gRPC Auto-generated Interface | Using the `PyMAPDL`_ Library |
@@ -78,6 +77,5 @@ At this point, because the assumption is that MAPDL is always remote, it's
7877
possible to issue commands to MAPDL, including those requiring
7978
file transfer like ``Mapdl.input``.
8079

81-
.. _REST: https://en.wikipedia.org/wiki/Representational_state_transfer
82-
.. _gRPC: https://grpc.io/
83-
.. _PyMAPDL: https://github.com/pyansys/pymapdl
80+
.. LINKS AND REFERENCES
81+
.. include:: ../links.rst

doc/source/coding_style/beyond_pep8.rst

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
Beyond PEP8
2-
###########
2+
===========
33
This topic describes any delineations, clarifications, or additional procedures above and
4-
beyond `PEP8 <https://www.python.org/dev/peps/pep-0008/>`__.
4+
beyond `PEP 8`_.
55

6-
For example, `Stack Overflow Answer <https://stackoverflow.com/questions/2536307>`_
7-
outlines deprecation best practices and a `Deprecation library <https://deprecation.readthedocs.io/>`_
8-
already exists. However, there is no official guidance regarding deprecating features
9-
in an API within Python. This page seeks to clarify this issue and others.
6+
For example, `Stack Overflow Answer`_ outlines deprecation best practices and a
7+
`Deprecation`_ library already exists. However, there is no official guidance
8+
regarding deprecating features in an API within Python. This page seeks to
9+
clarify this issue and others.
1010

1111
Aside from the following PyAnsys-specific directives, the best coding practice is to
12-
follow established guidelines from `PEP8 <https://www.python.org/dev/peps/pep-0008/>`__.
12+
follow established guidelines from `PEP 8`_.
1313

1414

1515
Deprecation Best Practice
@@ -18,8 +18,7 @@ Whenever a method, class, or function is deprecated, you must provide
1818
an old method that both calls the new method and raises a warning. Or,
1919
if the method has been removed, you must raise an ``AttributeError``.
2020

21-
In the docstring of the older method, provide a `Sphinx Deprecated Directive
22-
<https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-deprecated>`_
21+
In the docstring of the older method, provide a `Sphinx Deprecated Directive`_
2322
and a link to the newer method. This way, users are notified that an API change
2423
has occurred and are given an opportunity to change their code. Otherwise,
2524
stability concerns can cause users to stop upgrading, or worse, stop using
@@ -50,7 +49,7 @@ an error after a minor release or two.
5049
raise AttributeError('assignmaterial is deprecated. Use assign_material instead.')
5150
5251
def assign_material(self, obj, mat):
53-
"""Assign a material to one or more objects.
52+
"""Assign a material to one or more objects."""
5453
...
5554
5655
@@ -99,7 +98,7 @@ You can then use this custom ``DeprecationError`` in place of an ``Exception``.
9998
10099
Semantic Versioning and API Changes
101100
-----------------------------------
102-
According to `Semantic Versioning <https://semver.org/>`_, you should
101+
According to `Semantic Versioning`, you should
103102
increment the MAJOR version when you make incompatible changes.
104103
However, adding or eliminating methods should not be considered
105104
incompatible changes to a code base but rather incremental changes
@@ -110,8 +109,7 @@ should be bumped.
110109
To avoid constantly bumping the minor version, one approach to
111110
source-control branching is to create release branches where only
112111
patch fixes are pushed and API changes occur between minor
113-
releases. See `Trunk Based Development
114-
<https://trunkbaseddevelopment.com/>`_.
112+
releases. See `Trunk Based Development`_.
115113

116114
In summary, the mainline branch (commonly named ``main`` or ``master``)
117115
must always be ready to release, and developers should create
@@ -275,7 +273,7 @@ If the output of some operation in an example cannot be verified exactly,
275273
an ellipsis (``...``) can be used in the expected output. This allows it
276274
to match any substring in the actual output.
277275

278-
.. code ::
276+
.. code::
279277
280278
Examples
281279
--------
@@ -286,7 +284,7 @@ to match any substring in the actual output.
286284
287285
To support this, ``doctest`` must be run with the option set to allow ellipses.
288286

289-
.. code ::
287+
.. code::
290288
291289
pytest --doctest-modules -o ELLIPSIS file.py
292290
@@ -298,9 +296,15 @@ This is useful for examples that cannot run within ``pytest`` or have
298296
side effects that will affect the other tests if they are run during
299297
the ``doctest`` session.
300298

301-
.. code :: python
299+
.. code:: python
302300
303301
Examples
304302
--------
305303
306304
>>> desktop = Desktop("2021.1") # doctest: +SKIP
305+
306+
307+
.. LINKS AND REFERENCES
308+
.. include:: ../links.rst
309+
.. _Sphinx Deprecated Directive: https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-deprecated
310+
.. _Stack Overflow Answer: htps://stackoverflow.com/questions/2536307

doc/source/coding_style/flake8.rst

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
.. _style-guide-enforcement:
2-
31
Style Guide Enforcement
42
=======================
53
This topic describes the use of `flake8`_ for `PEP 8`_ style
@@ -8,11 +6,11 @@ are expected to be consistent with these guidelines.
86

97
Flake8
108
~~~~~~
11-
`flake8`_ is a Python tool for enforcing code styling. It is a wrapper
12-
around the following three tools: `PyFlakes`_, `pycodestyle`_, and
13-
`Ned Batchelder's McCabe script for complexity`_. Flake8 runs all three tools at once,
14-
checking the code against a variety of style rules, such as line length,
15-
code complexity, and whitespace.
9+
`Flake8`_ is a Python tool for enforcing code styling. It is a wrapper around
10+
the following three tools: `PyFlakes`_, `pycodestyle`_, and `Ned Batchelder's
11+
McCabe script for complexity`, also known as `mccabe`_. Flake8 runs all three
12+
tools at once, checking the code against a variety of style rules, such as line
13+
length, code complexity, and whitespace.
1614

1715
Configuring Flake8
1816
------------------
@@ -36,8 +34,7 @@ library:
3634
statistics = True
3735
3836
Flake8 has many options that can be set within the configuration file.
39-
For a list and descriptions, see this `Flake8 documentation topic
40-
<https://flake8.pycqa.org/en/latest/user/options.html>`__.
37+
For a list and descriptions, see this `Flake8 documentation topic`_.
4138

4239
The example configuration defines the following options:
4340

@@ -51,7 +48,7 @@ The example configuration defines the following options:
5148
check for and is not an exhaustive list.
5249

5350
For a full list of error codes and their descriptions, see this `Flake8
54-
documentation topic <https://flake8.pycqa.org/en/3.9.2/user/error-codes.html>`__.
51+
documentation topic`_
5552

5653
- ``count``
5754
Total number of errors to print at the end of the check.
@@ -109,8 +106,7 @@ rules.
109106

110107

111108
Optionally, it is possible to automate the use of `black`_. This can be
112-
done with the tool `pre-commit`_. Setting up a `pre-commit hook
113-
to run black <https://black.readthedocs.io/en/stable/integrations/source_version_control.html>`_
109+
done with the tool `pre-commit`_. Setting up a `pre-commit hook to run black`_
114110
will automatically format the code before committing. This simple way of
115111
incorporating code style checks into the development workflow to maintain
116112
`PEP 8`_ guidelines requires minimal manual effort.
@@ -183,12 +179,11 @@ expected in a PyAnsys library.
183179

184180
* `E501`_ - **Line too long.**
185181

186-
All code lines should not exceed 100 characters. The
187-
`PEP8 line length guideline <https://www.python.org/dev/peps/pep-0008/#maximum-line-length>`_
188-
suggests a maximum line length of 79. Following this limit
189-
is not as necessary today due to modern screen sizes. The suggested maximum
190-
length of 100 can be easier to accommodate and can still support
191-
viewing files side by side in code editors.
182+
All code lines should not exceed 100 characters. The `PEP8 line length
183+
guideline`_ suggests a maximum line length of 79. Following this limit is
184+
not as necessary today due to modern screen sizes. The suggested maximum
185+
length of 100 can be easier to accommodate and can still support viewing
186+
files side by side in code editors.
192187

193188
* `F401`_ - **Module imported but unused.**
194189

@@ -204,7 +199,7 @@ expected in a PyAnsys library.
204199
* **Limit complexity of code to 10.**
205200

206201
This is enforced by the ``max-complexity`` option described in
207-
:ref:`configuring-flake8`. Limiting code complexity leads to code that
202+
:ref:`PEP 8 Best Practices`. Limiting code complexity leads to code that
208203
is easier to understand and less risky to modify. Write low-
209204
complexity code when possible.
210205

@@ -221,4 +216,9 @@ Your ``.flake8`` file should be:
221216
max-line-length = 100
222217
statistics = True
223218
219+
220+
.. REFERENCES AND LIKNS
224221
.. include:: ../links.rst
222+
.. _Flake8 documentation topic: https://flake8.pycqa.org/en/3.9.2/user/error-codes.html
223+
.. _PEP8 line length guideline: https://www.python.org/dev/peps/pep-0008/#maximum-line-length
224+
.. _pre-commit hook to run black: https://black.readthedocs.io/en/stable/integrations/source_version_control.html

doc/source/coding_style/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Coding Style
2-
************
2+
############
33

44
PyAnsys libraries are expected to follow `PEP 8`_ and
55
be consistent in style and formatting with the 'big three'

doc/source/coding_style/pep8_best_practices.rst

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
.. _best_practices:
2-
31
PEP 8 Best Practices
42
====================
5-
This topic summarizes key points from `PEP8`_ and how
3+
This topic summarizes key points from `PEP 8`_ and how
64
they apply to PyAnsys libraries. The goal is for PyAnsys libraries to
75
be consistent in style and formatting with the `big three`
86
data science libraries: `NumPy`_, `SciPy`_, and `pandas`_.
@@ -15,8 +13,6 @@ module comments and docstrings and before module globals and
1513
constants. This reduces the likelihood of an `ImportError`_ that
1614
might only be discovered during runtime.
1715

18-
.. _ImportError: https://docs.python.org/3/library/exceptions.html#ImportError
19-
2016
Instead of:
2117

2218
.. code:: python
@@ -95,7 +91,7 @@ Use:
9591
9692
You should avoid using wild cards in imports because doing so
9793
can make it difficult to detect undefined names. For more information,
98-
see `Python Anti-Patterns: using wildcard imports <(https://docs.quantifiedcode.com/python-anti-patterns/maintainability/from_module_import_all_used.html>`_.
94+
see `Python Anti-Patterns: using wildcard imports`_.
9995

10096
Instead of:
10197

@@ -259,7 +255,7 @@ from PyPi.
259255
260256
Class Naming Conventions
261257
~~~~~~~~~~~~~~~~~~~~~~~~
262-
Use `camel case <https://en.wikipedia.org/wiki/Camel_case>`_ when naming classes. Do not separate words
258+
Use `camel case`_ when naming classes. Do not separate words
263259
with underscores.
264260

265261
.. code:: python
@@ -433,21 +429,17 @@ same line:
433429
434430
For a multi-line docstring, put the ending ``"""`` on a line by itself.
435431

436-
PyAEDT follows the `numpydoc
437-
<https://numpydoc.readthedocs.io/en/latest/format.html>`_
438-
docstring style, which is used by `numpy <https://numpy.org/>`_,
439-
`scipy <https://www.scipy.org/>`_, `pandas
440-
<https://pandas.pydata.org/>`_, and a variety of other Python open
441-
source projects. For more information on docstrings for PyAnsys
442-
libraries, see :ref:`api_documentation`.
432+
`PyAEDT`_ follows the `numpydoc`_ docstring style, which is used by `numpy`_
433+
`scipy`_, `pandas`_, and a variety of other Python open source projects. For
434+
more information on docstrings for PyAnsys libraries, see
435+
:ref:`API Documentation Style`.
443436

444437

445438
Programming Recommendations
446439
~~~~~~~~~~~~~~~~~~~~~~~~~~~
447-
The following sections provide some `PEP8
448-
<https://www.python.org/dev/peps/pep-0008/>`_ suggestions for removing
449-
ambiguity and preserving consistency. They address some common pitfalls
450-
when writing Python code.
440+
The following sections provide some `PEP 8`_ suggestions for removing ambiguity
441+
and preserving consistency. They address some common pitfalls when writing
442+
Python code.
451443

452444

453445
Booleans and Comparisons
@@ -714,6 +706,13 @@ Any library should be secure and implement good practices that avoid or mitigate
714706
This is especially relevant in libraries that request user input (such as web services).
715707
Because security is a broad topic, we recommend you review this useful Python-specific resource:
716708

717-
* `10 Unknown Security Pitfalls for Python <https://blog.sonarsource.com/10-unknown-security-pitfalls-for-python>`_ - By Dennis Brinkrolf - Sonar source blog
709+
* `10 Unknown Security Pitfalls for Python`_ - By Dennis Brinkrolf - Sonar source blog
718710

719-
.. [#] Wikipedia - `Software development security <https://en.wikipedia.org/wiki/Software_development_security>`_.
711+
712+
.. LINKS AND REFERENCES
713+
.. include:: ../links.rst
714+
.. [#] Wikipedia - Software development security https://en.wikipedia.org/wiki/Software_development_security
715+
.. _10 Unknown Security Pitfalls for Python: https://blog.sonarsource.com/10-unknown-security-pitfalls-for-python
716+
.. _camel case: https://en.wikipedia.org/wiki/Camel_case
717+
.. _ImportError: https://docs.python.org/3/library/exceptions.html#ImportError
718+
.. _Python Anti-Patterns\: using wildcard imports: https://docs.quantifiedcode.com/python-anti-patterns/maintainability/from_module_import_all_used.html
Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
.. _documentation_deployment:
2-
3-
41
Documentation Deployment
52
------------------------
6-
Documentation for the PyAnsys project is hosted via `GitHub Pages <https://pages.github.com/>`_.
7-
Given the open-source nature of the project, documentation built by each PyAnsys library or
8-
project should be public and editable by users and the community at large.
93

10-
After following the documentation build strategy contained within both
11-
the `pyansys/template <https://github.com/pyansys/template/>`_ and
12-
`pyansys-sphinx-theme
13-
<https://github.com/pyansys/pyansys-sphinx-theme>`_ you will end up
14-
with html documentation files in ``doc/build/html``.
4+
Documentation for the PyAnsys project is hosted via `GitHub Pages`_ Given the
5+
open-source nature of the project, documentation built by each PyAnsys library
6+
or project should be public and editable by users and the community at large.
7+
8+
After following the documentation build strategy contained within both the
9+
`ansys-templates`_ and `pyansys-sphinx-theme`_ you will end up with html
10+
documentation files in ``doc/build/html``.
11+
12+
.. Links and References
13+
.. include:: ../links.rst

0 commit comments

Comments
 (0)