Skip to content

Commit 0aeebca

Browse files
PipKatakaszynski
andauthored
Doc/general edits (#14)
* Update README.rst * Update app_interface_abstraction.rst * Update data_transfer_and_representation.rst * Update index.rst * Update service_abstraction.rst * Update best_practices.rst * Update data_transfer_and_representation.rst * Update best_practices.rst * Create best_practices.rst * Update flake8.rst * Update index.rst * Update class_documentation.rst * Update coding_style.rst * Update docstrings.rst * Update index.rst * Update sample_func.py * Update ci_cd.rst * Update ci_cd.rst * Update doc_directory.rst * Update index.rst * Update index.rst * Update index.rst * Update index.rst * Update index.rst * Update library_names.rst * Update license.rst * Update packaging.rst * Update packaging.rst * Update packaging.rst * Update packaging.rst * Update packaging.rst * Update packaging.rst * Update packaging.rst * Update packaging.rst * Update packaging.rst * Update packaging.rst * Update packaging.rst * Update readme_file.rst * Update repo_directory_structure.rst * Update source_organization.rst * Update administration.rst * Update contributing.rst * Update contributing.rst * Update contributing.rst * Update contributing.rst * Update administration.rst * Update dev_practices.rst * Update dev_practices.rst * Update index.rst * Update index.rst * Update index.rst * Update index.rst * Update index.rst * Update index.rst * fix links * Apply suggestions from code review Co-authored-by: Alex Kaszynski <[email protected]>
1 parent 3a43759 commit 0aeebca

26 files changed

+433
-424
lines changed

README.rst

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,38 @@ PyAnsys Developer's Guide
33

44
This guide serves as the central document for:
55

6-
- Ansys developers who want to create and "own" libraries.
6+
- Ansys developers who want to create and "own" libraries
77
- Anyone in the Python community who wants to contribute to a
8-
library.
8+
library
99
- Anyone who is interested in learning more about the PyAnsys
10-
project and libraries.
10+
project and libraries
1111

1212

13-
Web-based documentation will be posted upon approval.
13+
Web-based documentation is posted upon approval.
1414

15-
PDF version of this guide can be found in the release notes in `Releases
15+
A PDF version of this guide can be found in the release notes in `Releases
1616
<https://github.com/pyansys/about/releases>`_.
1717

1818

1919
Generate Documentation
2020
----------------------
21-
Generate this documentation locally by first installing the
21+
To generate this documentation locally, first install the
2222
requirements with:
2323

2424
.. code::
2525
2626
pip install -r requirements_docs.txt
2727
28-
Then build (on Windows) with:
28+
Then, depending on your operating system, generate the documentation.
29+
30+
On Windows, generate with:
2931

3032
.. code::
3133
3234
cd doc
3335
make.bat html
3436
35-
Or on Linux with:
37+
On Linux, generate with:
3638

3739
.. code::
3840
@@ -41,6 +43,6 @@ Or on Linux with:
4143
4244
Contributing
4345
------------
44-
Feel free to contribute to this guide by creating a branch and
45-
contributing directly, or forking and submitting a PR. All PRs will
46-
be reviewed before merge.
46+
To contribute to this guide, either create a branch and
47+
contribute directly or fork and submit a pull request. All
48+
pull requests are reviewed before they can be merged.

doc/source/abstraction/app_interface_abstraction.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ recorded script from AEDT versus using the PyAEDT libary to create an
1313
open region in the active editor:
1414

1515
+------------------------------------------------------+----------------------------------------------+
16-
| Using AEDT with MS COM Methods | Using AEDT with the `PyAEDT`_ Library |
16+
| Using a Recorded Script from AEDT (MS COM Methods) | Using the `PyAEDT`_ Library |
1717
+------------------------------------------------------+----------------------------------------------+
1818
| .. code:: python | .. code:: python |
1919
| | |
@@ -41,15 +41,15 @@ open region in the active editor:
4141

4242
Besides length and readability, the biggest difference between the two
4343
approaches is how the methods and attributes from the ``Hfss`` class
44-
are encapsulated. For example, AEDT no longer needs to be
44+
are encapsulated. For example, AEDT no longer needs to be
4545
explicitly instantiated and is hidden as a protected attribute
4646
``_desktop``. The connection to the application takes place
4747
automatically when ``Hfss`` is instantiated, and the active AEDT
4848
project, editor, and module are automatically used to create the
4949
open region.
5050

51-
Furthermore, the ``create_open_region`` method within ``Hfss``
52-
contains a full Python documentation string with keyword arguments,
51+
Furthermore, the ``create_open_region`` method within the ``Hfss``
52+
class contains a full Python documentation string with keyword arguments,
5353
clear ``numpydoc`` parameters and returns, and a basic example.
5454
These are unavailable when directly using COM methods, preventing
5555
the use of contextual help from within a Python IDE.
@@ -103,10 +103,10 @@ within this method.
103103
Here, the COM ``CreateOpenRegion`` method is abstracted, encapsulating
104104
the model setup object. There's no reason why a user needs direct
105105
access to ``_omodelsetup``, which is why it's protected in the
106-
``Hfss`` class. Additionally, calling the method is simplified by
106+
``Hfss`` class. Additionally, calling the method is simplified by
107107
providing (and documenting) the defaults using keyword arguments and
108108
placing them into the ``vars`` list, all while following the `Style
109109
Guide for Python Code (PEP8)`_.
110110

111111
.. _PyAEDT: https://github.com/pyansys/PyAEDT
112-
.. _Style Guide for Python Code (PEP8): https://www.python.org/dev/peps/pep-0008
112+
.. _Style Guide for Python Code (PEP8): https://www.python.org/dev/peps/pep-0008

doc/source/abstraction/data_transfer_and_representation.rst

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ Data Transfer and Abstraction
22
=============================
33
Abstracted APIs should attempt to hide the implementation details of
44
the remote or local API in a well organized data model. This data
5-
model should avoid returning raw JSON, gRPC messages, SWIG objects, or
6-
.NET objects. Rather, it preferable to return standard Python objects
7-
like lists, strings, dictionaries when useful, and NumPy arrays or
8-
pandas dataframes for more complex data.
5+
model should avoid returning raw JSON files, gRPC messages, SWIG objects,
6+
or .NET objects. It should preferably return standard Python objects
7+
like lists, strings, dictionaries when useful, and `NumPy <https://numpy.org/>`_
8+
arrays or `pandas <https://pandas.pydata.org/>`_ dataframes for more complex data.
99

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

@@ -16,9 +16,9 @@ For example, consider a simple mesh in MAPDL:
1616
>>> mapdl.et(1, 186)
1717
>>> mapdl.vmesh('ALL')
1818
19-
At this point, the only two ways within MAPDL to access the nodes and
20-
connectivity of the mesh are either to print it using the ``NLIST``
21-
command or to write it to disk using the ``CDWRITE`` command. Both
19+
At this point, there are only two ways within MAPDL to access the nodes and
20+
connectivity of the mesh, You can either print it using the ``NLIST``
21+
command or write it to disk using the ``CDWRITE`` command. Both of these
2222
methods are remarkably inefficient, requiring:
2323

2424
- Serializing the data to ASCII on the server
@@ -65,28 +65,28 @@ within the MAPDL database.
6565
[0.75, 0.5 , 0.5 ]])
6666
6767
68-
REST vs RPC Data and Model Abstraction
69-
--------------------------------------
70-
Because of the nature of Ansys's products, our applications and
71-
services can either fit into the RPC interface where the API is
72-
centered around operations and commands, or the REST model which is
73-
centered around resources. Regardless of the the interface style,
74-
there are several items to consider.
68+
REST Versus RPC Data and Model Abstraction
69+
------------------------------------------
70+
Because of the nature of most Ansys products, our applications and
71+
services can either fit into the RPC interface, where the API is
72+
centered around operations and commands, or the REST model, where
73+
the API is centered around resources. Regardless of the the interface
74+
style, there are several items to consider.
7575

7676

7777
API Chattiness
7878
~~~~~~~~~~~~~~
79-
APIs must be efficient to avoid creating chatty I/O. Because many of
80-
Ansys's products fit well with the RPC API implementation, there is a
81-
temptation to design APIs that require constant communication with the
82-
remote or local service. However, just because RPC interfaces can,
83-
does not mean they should as it should be assumed that each RPC call
84-
takes significant time to execute.
85-
86-
One way to avoid this approach is to either serialize several
87-
"commands" for services that employ an internal "command pattern" for
88-
data exchange. Another approach is to encapsulate the data model
89-
entirely on the server and avoid data transfer whenever possible and
79+
APIs must be efficient to avoid creating chatty input and output.
80+
Because many Ansys products fit well with the RPC API implementation,
81+
there is a temptation to design APIs that require constant communication
82+
with the remote or local service. However, just because RPC interfaces
83+
can do this, it does not mean that they should. The assumption should be
84+
that each RPC call takes significant time to execute.
85+
86+
One way to avoid constant communication with the service is to serialize
87+
several "commands" for services that employ an internal "command pattern"
88+
for data exchange. Another approach is to encapsulate the data model
89+
entirely on the server to avoid data transfer whenever possible and
9090
expose only a limited number of RPC methods in the front-facing API.
9191

9292
Compatibility and Efficiency
@@ -97,16 +97,15 @@ of the first choices due to its compatibility with nearly all popular
9797
languages and its efficiency over REST in terms of speed, memory, and
9898
payload size.
9999

100-
Typically, data exchange over REST should be limited to short messages
101-
exchanged over JSON, whereas gRPC can handle large data transfer and
102-
even allows for bidirectional streaming.
103-
104-
In general, it is preferable to choose gRPC over REST due to the
105-
performance benefits of a binary compatible protocol. While REST
106-
carries a variety of benefits, for complex client/server interactions,
107-
it is best to have an interface that can efficiently exchange a wide
108-
variety of data formats and messages.
100+
Typically, REST data exchanges should be limited to short messages
101+
transferred via JSON files, and gRPC should be used for large data
102+
transfers and bidirectional streaming.
109103

104+
Choosing gRPC over REST is generally preferable due to the performance
105+
benefits of a binary compatible protocol. While REST provides a variety of
106+
benefits, for complex client/server interactions, it is best to have an
107+
interface that can efficiently exchange a wide variety of data formats and
108+
messages.
110109

111110

112111
.. _gRPC: https://grpc.io/

doc/source/abstraction/index.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ of an application from the user and emphasizing only usage.
55

66
One of the main objectives of PyAnsys libraries is to wrap (encapsulate)
77
data and methods within units of execution while hiding data or parameters
8-
in protected variables. The topics in this section demonstrate how
9-
applications and complex services expose functionalities that matter to
10-
users and hide all else. For example, because background details,
11-
implementation, and hidden states do not need to be exposed to users,
12-
they are hidden.
8+
in protected variables.
9+
10+
The topics in this section demonstrate how applications and complex services
11+
expose functionalities that matter to users and hide all else. For example,
12+
background details, implementation, and hidden states can all be hidden.
1313

1414
.. toctree::
1515
:hidden:
@@ -18,4 +18,4 @@ they are hidden.
1818
app_interface_abstraction
1919
service_abstraction
2020
data_transfer_and_representation
21-
21+

doc/source/abstraction/service_abstraction.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ This example includes ``launch_mapdl``, which brokers a connection via the
7272
ansys.mapdl Version: 0.59.dev0
7373
7474
This straightforward approach connects to a local or remote instance
75-
of MAPDL via gRPC by instantiating an instance of the ``Mapdl``. class.
75+
of MAPDL via gRPC by instantiating an instance of the ``Mapdl`` class.
7676
At this point, because the assumption is that MAPDL is always remote, it's
7777
possible to issue commands to MAPDL, including those requiring
7878
file transfer like ``Mapdl.input``.

0 commit comments

Comments
 (0)