Skip to content

Commit 58e7b72

Browse files
committed
Fix links and cross-references
1 parent 227ef9d commit 58e7b72

File tree

10 files changed

+109
-111
lines changed

10 files changed

+109
-111
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/guidelines/dev_practices.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
.. _development_practices:
2-
31
Development Practices
42
=====================
53
This page explains how PyAnsys development is conducted. When
64
contributing to a PyAnsys repository, use these general
75
coding paradigms:
86

9-
#. Follow the `Zen of Python <https://www.python.org/dev/peps/pep-0020/>`__.
7+
#. Follow the `Zen of Python <https://www.python.org/dev/peps/pep-0020/>`_.
108
As silly as core Python developers are sometimes, there's much to be
119
gained by following the basic guidelines listed in PEP 20. As suggested
1210
in these guidelines, focus on making your additions intuitive, novel,
1311
and helpful for PyAnsys users. When in doubt, use ``import this``.
14-
For Ansys code quality standards, see :ref:`coding_style`.
12+
For Ansys code quality standards, see :ref:`Coding Style`.
1513

1614
#. Document your contributions. Include a docstring for any added
1715
function, method, or class, following `numpydocs docstring <https://numpydoc.readthedocs.io/en/latest/format.html>`_

doc/source/links.rst

Lines changed: 43 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
.. PYANSYS PROJECTS
55
.. _ansys-api-mapdl: https://pypi.org/project/ansys-api-mapdl/
66
.. _ansys-templates: https://templates.pyansys.com/index.html
7+
.. _pyansys-protos-generator: https://github.com/pyansys/pyansys-protos-generator
8+
.. _grpc_chunk_stream_demo: https://github.com/pyansys/grpc_chunk_stream_demo
79
.. _PyAEDT: https://github.com/pyansys/pyaedt
10+
.. _PyMAPDL: https://github.com/pyansys/pymapdl
811
.. _PyAnsys: https://docs.pyansys.com/
912
.. _PyAnsys PyPI: https://pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi
1013
.. _PyAnsys GitHub Organization: https://github.com/pyansys
@@ -17,6 +20,7 @@
1720
.. CODE FORMATTING AND QUALITY TOOLS
1821
.. _black: https://black.readthedocs.io/en/stable/
1922
.. _flake8: https://flake8.pycqa.org/en/latest/index.html
23+
.. _pre-commit: https://pre-commit.com/
2024
.. _pycodestyle: https://pypi.org/project/pycodestyle/
2125
.. _pyflakes: https://pypi.org/project/pyflakes/
2226

@@ -33,11 +37,43 @@
3337
.. _sphinx: https://www.sphinx-doc.org/en/master/
3438
.. _sphinx-gallery: https://sphinx-gallery.github.io/
3539

36-
.. PYTHON ECOSYSTEM
40+
.. FLAKE8 RULE CODES
41+
.. _E115: https://www.flake8rules.com/rules/E115.html
42+
.. _E117: https://www.flake8rules.com/rules/E117.html
43+
.. _E122: https://www.flake8rules.com/rules/E122.html
44+
.. _E124: https://www.flake8rules.com/rules/E124.html
45+
.. _E125: https://www.flake8rules.com/rules/E125.html
46+
.. _E225: https://www.flake8rules.com/rules/E225.html
47+
.. _E231: https://www.flake8rules.com/rules/E231.html
48+
.. _E301: https://www.flake8rules.com/rules/E301.html
49+
.. _E303: https://www.flake8rules.com/rules/E303.html
50+
.. _E501: https://www.flake8rules.com/rules/E501.html
51+
.. _F401: https://www.flake8rules.com/rules/F401.html
52+
.. _F403: https://www.flake8rules.com/rules/F403.html
53+
.. _W191: https://www.flake8rules.com/rules/W191.html
54+
.. _W291: https://www.flake8rules.com/rules/W291.html
55+
.. _W293: https://www.flake8rules.com/rules/W293.html
56+
.. _W391: https://www.flake8rules.com/rules/W391.html
57+
58+
.. GIT
59+
.. _Semantic Versioning: https://semver.org/
60+
.. _Trunk Based Development: https://trunkbaseddevelopment.com/
61+
62+
63+
.. LICENSES
64+
.. _MIT License: https://opensource.org/licenses/MIT
65+
66+
.. PYTHON ECOSYSTEM AND LIBRARIES
3767
.. _Python Packaging Authority: https://www.pypa.io/en/latest/
3868
.. _Python Packaging User Guide: https://packaging.python.org/en/latest/
3969
.. _pip: https://pip.pypa.io/en/latest/
4070

71+
.. THIRD PARTY LIBRARIES
72+
.. _deprecation: https://deprecation.readthedocs.io/en/latest/
73+
.. _numpy: https://numpy.org/
74+
.. _pandas: https://pandas.pydata.org/
75+
.. _scipy: https://scipy.org/
76+
4177
.. PYTHON ENHANCEMENT PROPOSAL (PEP) LINKS
4278
.. _PEP 8: https://peps.python.org/pep-0008/
4379
.. _PEP 20: https://peps.python.org/pep-0020/
@@ -46,30 +82,17 @@
4682
.. _PEP 517: https://peps.python.org/pep-0517/
4783
.. _PEP 518: https://peps.python.org/pep-0518/
4884

85+
.. COMMON TECHNOLOGIES
86+
.. _gRPC: https://grpc.io/
87+
.. _rest: https://en.wikipedia.org/wiki/Representational_state_transfer
88+
.. _SWIG: http://www.swig.org/
89+
4990
.. UNIT TESTING AND CI TOOLS
5091
.. _codecov.io: https://app.codecov.io/gh/pyansys
5192
.. _dependabot: https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/about-dependabot-version-updates
5293
.. _GitHub Actions: https://github.com/features/actions
5394
.. _GitHub Releases: https://docs.github.com/en/github/administering-a-repository/releasing-projects-on-github/managing-releases-in-a-repository
5495
.. _pytest: https://docs.pytest.org/en/latest/
5596
.. _pytest-cov: https://pytest-cov.readthedocs.io/en/latest/
56-
.. _Test driven development: https://en.wikipedia.org/wiki/Test-driven_development
97+
.. _Test Driven Development: https://en.wikipedia.org/wiki/Test-driven_development
5798
.. _Tox: https://tox.wiki/en/latest/
58-
59-
.. FLAKE8 RULE CODES
60-
.. _E115: https://www.flake8rules.com/rules/E115.html
61-
.. _E117: https://www.flake8rules.com/rules/E117.html
62-
.. _E122: https://www.flake8rules.com/rules/E122.html
63-
.. _E124: https://www.flake8rules.com/rules/E124.html
64-
.. _E125: https://www.flake8rules.com/rules/E125.html
65-
.. _E225: https://www.flake8rules.com/rules/E225.html
66-
.. _E231: https://www.flake8rules.com/rules/E231.html
67-
.. _E301: https://www.flake8rules.com/rules/E301.html
68-
.. _E303: https://www.flake8rules.com/rules/E303.html
69-
.. _E501: https://www.flake8rules.com/rules/E501.html
70-
.. _F401: https://www.flake8rules.com/rules/F401.html
71-
.. _F403: https://www.flake8rules.com/rules/F403.html
72-
.. _W191: https://www.flake8rules.com/rules/W191.html
73-
.. _W291: https://www.flake8rules.com/rules/W291.html
74-
.. _W293: https://www.flake8rules.com/rules/W293.html
75-
.. _W391: https://www.flake8rules.com/rules/W391.html

0 commit comments

Comments
 (0)