-
Notifications
You must be signed in to change notification settings - Fork 8
Collect common links under custom file #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -3,10 +3,10 @@ Data Transfer | |||||
|
||||||
Abstracted APIs should attempt to hide the implementation details of | ||||||
the remote or local API in a well organized data model. This data | ||||||
model should avoid returning raw JSON files, gRPC messages, SWIG objects, | ||||||
model should avoid returning raw JSON files, gRPC messages, `SWIG`_ objects, | ||||||
or .NET objects. It should preferably return standard Python objects | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
like lists, strings, dictionaries when useful, and `NumPy <https://numpy.org/>`_ | ||||||
arrays or `pandas <https://pandas.pydata.org/>`_ dataframes for more complex data. | ||||||
like lists, strings, dictionaries when useful, and `NumPy`_ | ||||||
arrays or `pandas`_ dataframes for more complex data. | ||||||
|
||||||
For example, consider a simple mesh in MAPDL: | ||||||
|
||||||
|
@@ -109,16 +109,5 @@ interface that can efficiently exchange a wide variety of data formats and | |||||
messages. | ||||||
|
||||||
|
||||||
.. _gRPC: https://grpc.io/ | ||||||
.. _pythoncom: http://timgolden.me.uk/pywin32-docs/pythoncom.html | ||||||
.. _SWIG: http://www.swig.org/ | ||||||
.. _C extensions: https://docs.python.org/3/extending/extending.html | ||||||
.. _Anaconda Distribution: https://www.anaconda.com/products/individual | ||||||
.. _REST: https://en.wikipedia.org/wiki/Representational_state_transfer | ||||||
.. _PyAEDT: https://github.com/pyansys/PyAEDT | ||||||
.. _PyMAPDL: https://github.com/pyansys/pymapdl | ||||||
.. _pymapdl: https://github.com/pyansys/pymapdl | ||||||
.. _Style Guide for Python Code (PEP8): https://www.python.org/dev/peps/pep-0008 | ||||||
.. _grpc_chunk_stream_demo: https://github.com/pyansys/grpc_chunk_stream_demo | ||||||
.. _numpydoc: https://numpydoc.readthedocs.io/en/latest/format.html | ||||||
.. _Namespace Packages: https://packaging.python.org/guides/packaging-namespace-packages/ | ||||||
.. LINKS AND REFERENCES | ||||||
jorgepiloto marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
.. include:: ../links.rst |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -10,12 +10,11 @@ the "desktop API". In this case, remote API calls should be identical | |||||||||||||||||||||
if the service is local or remote, with the only difference being that local | ||||||||||||||||||||||
calls are faster to execute. | ||||||||||||||||||||||
|
||||||||||||||||||||||
Consider the following code examples. The left-hand side shows the | ||||||||||||||||||||||
amount of work to start, establish a connection to, and submit an | ||||||||||||||||||||||
input file to MAPDL using auto-generated gRPC interface files. For | ||||||||||||||||||||||
more information, see `pyansys-protos-generator | ||||||||||||||||||||||
<https://github.com/pyansys/pyansys-protos-generator>`_. The | ||||||||||||||||||||||
right-hand side shows the same workflow but uses the `PyMAPDL`_ library. | ||||||||||||||||||||||
Consider the following code examples. The left-hand side shows the amount of | ||||||||||||||||||||||
work to start, establish a connection to, and submit an input file to MAPDL | ||||||||||||||||||||||
using auto-generated gRPC interface files. For more information, see | ||||||||||||||||||||||
`pyansys-protos-generator`_. The right-hand side shows the same workflow but | ||||||||||||||||||||||
uses the `PyMAPDL`_ library. | ||||||||||||||||||||||
Comment on lines
+13
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
|
||||||||||||||||||||||
+----------------------------------------------------------+--------------------------------------------+ | ||||||||||||||||||||||
| 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 | |||||||||||||||||||||
possible to issue commands to MAPDL, including those requiring | ||||||||||||||||||||||
file transfer like ``Mapdl.input``. | ||||||||||||||||||||||
|
||||||||||||||||||||||
.. _REST: https://en.wikipedia.org/wiki/Representational_state_transfer | ||||||||||||||||||||||
.. _gRPC: https://grpc.io/ | ||||||||||||||||||||||
.. _PyMAPDL: https://github.com/pyansys/pymapdl | ||||||||||||||||||||||
.. LINKS AND REFERENCES | ||||||||||||||||||||||
.. include:: ../links.rst |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,15 +1,15 @@ | ||||||
Beyond PEP8 | ||||||
########### | ||||||
=========== | ||||||
This topic describes any delineations, clarifications, or additional procedures above and | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
beyond `PEP8 <https://www.python.org/dev/peps/pep-0008/>`__. | ||||||
beyond `PEP 8`_. | ||||||
|
||||||
For example, `Stack Overflow Answer <https://stackoverflow.com/questions/2536307>`_ | ||||||
outlines deprecation best practices and a `Deprecation library <https://deprecation.readthedocs.io/>`_ | ||||||
already exists. However, there is no official guidance regarding deprecating features | ||||||
in an API within Python. This page seeks to clarify this issue and others. | ||||||
For example, `Stack Overflow Answer`_ outlines deprecation best practices and a | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
`Deprecation`_ library already exists. However, there is no official guidance | ||||||
regarding deprecating features in an API within Python. This page seeks to | ||||||
clarify this issue and others. | ||||||
|
||||||
Aside from the following PyAnsys-specific directives, the best coding practice is to | ||||||
follow established guidelines from `PEP8 <https://www.python.org/dev/peps/pep-0008/>`__. | ||||||
follow established guidelines from `PEP 8`_. | ||||||
|
||||||
|
||||||
Deprecation Best Practice | ||||||
|
@@ -18,8 +18,7 @@ Whenever a method, class, or function is deprecated, you must provide | |||||
an old method that both calls the new method and raises a warning. Or, | ||||||
if the method has been removed, you must raise an ``AttributeError``. | ||||||
|
||||||
In the docstring of the older method, provide a `Sphinx Deprecated Directive | ||||||
<https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-deprecated>`_ | ||||||
In the docstring of the older method, provide a `Sphinx Deprecated Directive`_ | ||||||
and a link to the newer method. This way, users are notified that an API change | ||||||
has occurred and are given an opportunity to change their code. Otherwise, | ||||||
stability concerns can cause users to stop upgrading, or worse, stop using | ||||||
|
@@ -50,7 +49,7 @@ an error after a minor release or two. | |||||
raise AttributeError('assignmaterial is deprecated. Use assign_material instead.') | ||||||
|
||||||
def assign_material(self, obj, mat): | ||||||
"""Assign a material to one or more objects. | ||||||
"""Assign a material to one or more objects.""" | ||||||
... | ||||||
|
||||||
|
||||||
|
@@ -99,7 +98,7 @@ You can then use this custom ``DeprecationError`` in place of an ``Exception``. | |||||
|
||||||
Semantic Versioning and API Changes | ||||||
----------------------------------- | ||||||
According to `Semantic Versioning <https://semver.org/>`_, you should | ||||||
According to `Semantic Versioning`, you should | ||||||
increment the MAJOR version when you make incompatible changes. | ||||||
However, adding or eliminating methods should not be considered | ||||||
incompatible changes to a code base but rather incremental changes | ||||||
|
@@ -110,8 +109,7 @@ should be bumped. | |||||
To avoid constantly bumping the minor version, one approach to | ||||||
source-control branching is to create release branches where only | ||||||
patch fixes are pushed and API changes occur between minor | ||||||
releases. See `Trunk Based Development | ||||||
<https://trunkbaseddevelopment.com/>`_. | ||||||
releases. See `Trunk Based Development`_. | ||||||
|
||||||
In summary, the mainline branch (commonly named ``main`` or ``master``) | ||||||
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, | |||||
an ellipsis (``...``) can be used in the expected output. This allows it | ||||||
to match any substring in the actual output. | ||||||
|
||||||
.. code :: | ||||||
.. code:: | ||||||
|
||||||
Examples | ||||||
-------- | ||||||
|
@@ -286,7 +284,7 @@ to match any substring in the actual output. | |||||
|
||||||
To support this, ``doctest`` must be run with the option set to allow ellipses. | ||||||
|
||||||
.. code :: | ||||||
.. code:: | ||||||
|
||||||
pytest --doctest-modules -o ELLIPSIS file.py | ||||||
|
||||||
|
@@ -298,9 +296,15 @@ This is useful for examples that cannot run within ``pytest`` or have | |||||
side effects that will affect the other tests if they are run during | ||||||
the ``doctest`` session. | ||||||
|
||||||
.. code :: python | ||||||
.. code:: python | ||||||
|
||||||
Examples | ||||||
-------- | ||||||
|
||||||
>>> desktop = Desktop("2021.1") # doctest: +SKIP | ||||||
|
||||||
|
||||||
.. LINKS AND REFERENCES | ||||||
.. include:: ../links.rst | ||||||
.. _Sphinx Deprecated Directive: https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-deprecated | ||||||
.. _Stack Overflow Answer: htps://stackoverflow.com/questions/2536307 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.