Skip to content

Commit 09d5b2d

Browse files
feat: Migrate report tool (#26)
* feat: Migrate report tool * fix: Ansys local env var * fix: remove env var * fix: Report tests with installation * fix: env vars * doc: Add documentation for report tool * fix: API reference reference * fix: Titles and links
1 parent f3de8be commit 09d5b2d

File tree

11 files changed

+709
-7
lines changed

11 files changed

+709
-7
lines changed

doc/source/getting_started/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ quickly begin using it. If you are interested in contributing to theAnsys tools
88
see :ref:`contribute` for information on installing in developer mode.
99

1010
Installation
11-
============
11+
------------
1212

1313
To use `pip <https://pypi.org/project/pip/>`_ to install the Ansys tools common project,
1414
run this command:

doc/source/user_guide/index.rst

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,26 @@ your own code.
3131

3232
Learn how to use the common exceptions.
3333

34+
.. grid-item-card:: Ansys versioning tool
35+
:padding: 2 2 2 2
36+
:link: versioning
37+
:link-type: doc
38+
39+
Learn how to use the versioning tool.
40+
41+
.. grid-item-card:: Ansys report tool
42+
:padding: 2 2 2 2
43+
:link: report
44+
:link-type: doc
45+
46+
Learn how to use the report tool.
47+
3448
.. toctree::
3549
:hidden:
3650
:maxdepth: 3
3751

3852
ansys_tools_path
3953
ansys_downloader
4054
ansys_exceptions
41-
versioning
55+
versioning
56+
report

doc/source/user_guide/report.rst

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
.. _ref_report:
2+
3+
User guide
4+
==========
5+
6+
This section explains how to use ``pyansys-tools-report`` and its features.
7+
8+
Using PyAnsys Tools Report
9+
--------------------------
10+
11+
Once the ``pyansys-tools-report`` package is installed in your own personal environment (if not, please proceed
12+
to :ref:`ref_getting_started`), you can start importing the package and using it.
13+
14+
In order to import the package, please run:
15+
16+
.. code:: python
17+
18+
import ansys.tools.report as pyansys_report
19+
20+
The ``pyansys-tools-report`` contains a main class called ``Report``. This class is basically an extension of the
21+
``scooby.Report``, but customized for showing Ansys libraries and variables in a common format.
22+
23+
The possible arguments that the ``Report`` class accepts can be found in the `API reference <../api/index.html>`_. Please, have a look
24+
at it to understand the arguments you may use. A simple example of Ansys variables and libraries is shown below.
25+
26+
.. code:: python
27+
28+
# After defining my_ansys_libs and my_ansys_vars with the needed format (see API Reference)
29+
# we can start the instantiation of the report
30+
#
31+
# Instantiate a Report object
32+
rep = report.Report(ansys_libs=my_ansys_libs, ansys_vars=my_ansys_vars)
33+
34+
# For printing the report
35+
rep
36+
37+
The typical output of a ``Report`` would look as follows:
38+
39+
.. code-block:: text
40+
41+
>>> -------------------------------------------------------------------------------
42+
>>> PyAnsys Software and Environment Report
43+
>>> -------------------------------------------------------------------------------
44+
>>> Date: Wed Nov 30 14:54:58 2022 Romance Standard Time
45+
>>>
46+
>>> OS : Windows
47+
>>> CPU(s) : 16
48+
>>> Machine : AMD64
49+
>>> Architecture : 64bit
50+
>>> Environment : Python
51+
>>> GPU Vendor : Intel
52+
>>> GPU Renderer : Intel(R) UHD Graphics
53+
>>> GPU Version : 4.5.0 - Build 30.0.100.9955
54+
>>>
55+
>>> Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)]
56+
>>>
57+
>>> ansys-mapdl-core : X.Y.Z
58+
>>> ansys-dpf-core : X.Y.Z
59+
>>> ansys-dpf-post : X.Y.Z
60+
>>> ansys-dpf-gate : X.Y.Z
61+
>>> ansys-fluent-core : X.Y.Z
62+
>>> pyaedt : X.Y.Z
63+
>>> ansys-platform-instancemanagement : X.Y.Z
64+
>>> ansys-grantami-bomanalytics : X.Y.Z
65+
>>> ansys-openapi-common : X.Y.Z
66+
>>> ansys-mapdl-reader : X.Y.Z
67+
>>> ansys-fluent-visualization : X.Y.Z
68+
>>> ansys-fluent-parametric : X.Y.Z
69+
>>> ansys-sphinx-theme : X.Y.Z
70+
>>> ansys-seascape : X.Y.Z
71+
>>> pyansys-tools-report : X.Y.Z
72+
>>> pyansys-tools-versioning : X.Y.Z
73+
>>> matplotlib : X.Y.Z
74+
>>> numpy : X.Y.Z
75+
>>> pyvista : X.Y.Z
76+
>>> appdirs : X.Y.Z
77+
>>> tqdm : X.Y.Z
78+
>>> pyiges : X.Y.Z
79+
>>> scipy : X.Y.Z
80+
>>> grpc : X.Y.Z
81+
>>> google.protobuf : X.Y.Z
82+
>>>
83+
>>>
84+
>>> -------------------------------------------------------------------------------
85+
>>> Ansys Environment Report
86+
>>> -------------------------------------------------------------------------------
87+
>>>
88+
>>>
89+
>>> Ansys Installation
90+
>>> ******************
91+
>>> Version Location
92+
>>> ------------------
93+
>>> MyLib1 v1.2
94+
>>> MyLib2 v1.3
95+
>>>
96+
>>>
97+
>>> Ansys Environment Variables
98+
>>> ***************************
99+
>>> MYVAR_1 VAL_1
100+
>>> MYVAR_2 VAL_2
101+
102+
103+
By default, the ``Report`` class would look for a certain set of environment variables. The following
104+
strings are searched for in the available environment variables. If any match is found, they are included
105+
in the report:
106+
107+
* ``AWP_ROOT``
108+
* ``ANS``
109+
* ``MAPDL``
110+
* ``FLUENT``
111+
* ``AEDT``
112+
* ``DPF``
113+
114+
Also, several Python packages are reported by default. The set of reported packages always includes
115+
the following list:
116+
117+
* ``ansys-mapdl-core``
118+
* ``ansys-dpf-core``
119+
* ``ansys-dpf-post``
120+
* ``ansys-dpf-gate``
121+
* ``ansys-fluent-core``
122+
* ``pyaedt``
123+
* ``ansys-platform-instancemanagement``
124+
* ``ansys-grantami-bomanalytics``
125+
* ``ansys-openapi-common``
126+
* ``ansys-mapdl-reader``
127+
* ``ansys-fluent-visualization``
128+
* ``ansys-fluent-parametric``
129+
* ``ansys-sphinx-theme``
130+
* ``ansys-seascape``
131+
* ``pyansys-tools-report``
132+
* ``pyansys-tools-versioning``
133+
* ``matplotlib``
134+
* ``numpy``
135+
* ``pyvista``
136+
* ``appdirs``
137+
* ``tqdm``
138+
* ``pyiges``
139+
* ``scipy``
140+
* ``grpc``
141+
* ``google.protobuf``
142+
143+
If you want the ``Report`` class to look for some extra environment variables by default, please
144+
`raise an issue <https://github.com/ansys/ansys-tools-common/issues>`_.
145+
146+
Enjoy its use. If you have any doubts, please raise a question/issue in the
147+
`PyAnsys Tools Report Issues <https://github.com/ansys/ansys-tools-common/issues>`_ site.

doc/source/user_guide/versioning.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. ref_versioning:
22
33
User guide
4-
##########
4+
==========
55

66
The fundamental object provided by ``ansys.tools.versioning`` is a decorator
77
named :meth:`ansys.tools.versioning.requires_version` which accepts:
@@ -14,7 +14,7 @@ named :meth:`ansys.tools.versioning.requires_version` which accepts:
1414

1515

1616
How to use
17-
==========
17+
----------
1818
The ``requires_version`` decorator is expected to be used in all the desired
1919
methods of a class containing a ``_server_version`` attribute. If the class in
2020
which it is used does not contain this attribute, an ``AttributeError`` is
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
(?i)Ansys
2-
pytest
2+
pytest
3+
ANS

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ classifiers = [
2525
dependencies = [
2626
"platformdirs>=3.6.0",
2727
"click>=8.1.3", # for CLI interface
28+
"scooby>=0.5.12",
2829
]
2930

3031
[project.optional-dependencies]

src/ansys/tools/common/path/applications/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class ApplicationPlugin:
3434
"""Class for application plugins."""
3535

3636
def is_valid_executable_path(self, exe_loc: str) -> bool:
37-
r"""Check if the executable path is valid for the application.
37+
"""Check if the executable path is valid for the application.
3838
3939
Parameters
4040
----------

src/ansys/tools/common/path/path.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def _get_default_windows_base_path() -> Optional[str]: # pragma: no cover
189189

190190

191191
def _is_float(input_string: str) -> bool:
192-
r"""Return true when a string can be converted to a float.
192+
"""Return true when a string can be converted to a float.
193193
194194
Parameters
195195
----------
File renamed without changes.

0 commit comments

Comments
 (0)