Skip to content

Commit b349dd4

Browse files
eblanco-ansyspyansys-ci-botpre-commit-ci[bot]SMoraisAnsysSamuelopez-ansys
authored
FEAT: Local test configuration cli (#6880)
Co-authored-by: pyansys-ci-bot <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Sébastien Morais <[email protected]> Co-authored-by: Samuel Lopez <[email protected]>
1 parent 951de03 commit b349dd4

File tree

6 files changed

+1289
-72
lines changed

6 files changed

+1289
-72
lines changed

doc/changelog.d/6880.added.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Local test configuration cli

doc/source/Getting_started/cli.rst

Lines changed: 280 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,280 @@
1+
Command line interface
2+
======================
3+
4+
PyAEDT provides a command line interface (CLI) to help you manage AEDT processes and test configurations
5+
from your terminal. The CLI offers simple commands to start, stop, and monitor AEDT sessions without
6+
writing any Python code.
7+
8+
Get started
9+
-----------
10+
11+
To use the CLI, open your terminal and type:
12+
13+
.. code-block:: bash
14+
15+
pyaedt --help
16+
17+
This displays all available commands and options.
18+
19+
20+
Main Commands
21+
-------------
22+
23+
The PyAEDT CLI provides four main commands:
24+
25+
* ``version`` - Display the installed PyAEDT version
26+
* ``processes`` - List all running AEDT processes
27+
* ``start`` - Start a new AEDT session
28+
* ``stop`` - Stop running AEDT processes
29+
* ``config`` - Manage test configuration settings
30+
31+
32+
Display version
33+
~~~~~~~~~~~~~~~
34+
35+
Check which version of PyAEDT you have installed:
36+
37+
.. code-block:: bash
38+
39+
pyaedt version
40+
41+
This shows the current PyAEDT version number.
42+
43+
44+
List running processes
45+
~~~~~~~~~~~~~~~~~~~~~~
46+
47+
View all AEDT processes currently running on your system:
48+
49+
.. code-block:: bash
50+
51+
pyaedt processes
52+
53+
This command displays useful information for each process:
54+
55+
* Process ID (PID)
56+
* Process name
57+
* Command line arguments
58+
* Port number (if available)
59+
60+
61+
Start AEDT
62+
~~~~~~~~~~
63+
64+
Launch a new AEDT session directly from the command line:
65+
66+
.. code-block:: bash
67+
68+
pyaedt start
69+
70+
This starts AEDT with default settings (latest AEDT version released, graphical mode).
71+
72+
You can customize the startup with these options:
73+
74+
**Set AEDT Version**
75+
76+
.. code-block:: bash
77+
78+
pyaedt start --version 2025.2
79+
pyaedt start -v 2025.2
80+
81+
**Non-Graphical Mode**
82+
83+
Run AEDT without the user interface (useful for automation):
84+
85+
.. code-block:: bash
86+
87+
pyaedt start --non-graphical
88+
pyaedt start -ng
89+
90+
**Specify Port**
91+
92+
Set a specific port for the AEDT connection:
93+
94+
.. code-block:: bash
95+
96+
pyaedt start --port 50051
97+
pyaedt start -p 50051
98+
99+
**Student Version**
100+
101+
Start the AEDT Student edition:
102+
103+
.. code-block:: bash
104+
105+
pyaedt start --student
106+
107+
**Combine Options**
108+
109+
You can use multiple options together:
110+
111+
.. code-block:: bash
112+
113+
pyaedt start -v 2025.2 -ng -p 50051
114+
115+
116+
Stop AEDT
117+
~~~~~~~~~
118+
119+
Stop running AEDT processes using different methods:
120+
121+
**Stop by Process ID**
122+
123+
.. code-block:: bash
124+
125+
pyaedt stop --pid 12345
126+
127+
Stop multiple processes:
128+
129+
.. code-block:: bash
130+
131+
pyaedt stop --pid 12345 --pid 67890
132+
133+
**Stop by Port**
134+
135+
.. code-block:: bash
136+
137+
pyaedt stop --port 50051
138+
139+
**Stop All AEDT Processes**
140+
141+
.. code-block:: bash
142+
143+
pyaedt stop --all
144+
pyaedt stop -a
145+
146+
147+
Test configuration management
148+
------------------------------
149+
150+
The ``config test`` command helps you create and modify the test configuration file
151+
used when running PyAEDT tests. This is useful for developers and contributors.
152+
153+
Launch the interactive configuration tool:
154+
155+
.. code-block:: bash
156+
157+
pyaedt config test
158+
159+
This starts a guided setup that walks you through all configuration options and saves
160+
the configuration to ``tests/local_config.json``.
161+
162+
To see your configuration without making changes:
163+
164+
.. code-block:: bash
165+
166+
pyaedt config test --show
167+
pyaedt config test -s
168+
169+
You can also set individual values directly. For example:
170+
171+
.. code-block:: bash
172+
173+
pyaedt config test desktop-version 2025.2
174+
pyaedt config test non-graphical true
175+
pyaedt config test use-grpc true
176+
177+
For a complete description of all configuration parameters and their usage, see the
178+
:ref:`Local testing parameters <contributing_aedt>` section in the Contributing guide.
179+
180+
181+
Practical examples
182+
------------------
183+
184+
Here are some common workflows using the CLI:
185+
186+
**Start AEDT and Check Status**
187+
188+
.. code-block:: bash
189+
190+
# Start AEDT
191+
pyaedt start -v 2025.2
192+
193+
# Check it's running
194+
pyaedt processes
195+
196+
# Stop when done
197+
pyaedt stop --all
198+
199+
**Automation Script**
200+
201+
.. code-block:: bash
202+
203+
# Start AEDT in non-graphical mode on a specific port
204+
pyaedt start -ng -p 50051
205+
206+
# Your automation code runs here
207+
python my_script.py
208+
209+
# Clean up
210+
pyaedt stop --port 50051
211+
212+
**Configure Tests**
213+
214+
.. code-block:: bash
215+
216+
# Use interactive mode
217+
pyaedt config test
218+
219+
# Or set values directly
220+
pyaedt config test desktop-version 2025.2
221+
222+
**Emergency Cleanup**
223+
224+
If AEDT processes are stuck:
225+
226+
.. code-block:: bash
227+
228+
# See what's running
229+
pyaedt processes
230+
231+
# Stop everything
232+
pyaedt stop --all
233+
234+
235+
Troubleshooting
236+
---------------
237+
238+
**Command Not Found**
239+
240+
If ``pyaedt`` command is not recognized, ensure PyAEDT is installed with CLI support:
241+
242+
.. code-block:: bash
243+
244+
pip install pyaedt[all]
245+
246+
**Cannot Stop Process**
247+
248+
If you get "Access denied" errors:
249+
250+
* You can only stop processes owned by your user
251+
* Some processes may require administrator privileges
252+
* Try closing AEDT normally from the application first
253+
254+
**AEDT Won't Start**
255+
256+
Common issues when starting AEDT:
257+
258+
* Verify AEDT is installed and in your system PATH
259+
* Check the version number is correct (for example, 2025.1, 2025.2)
260+
* Ensure license server is available
261+
262+
**Configuration Not Found**
263+
264+
The test configuration is created in the ``tests`` folder relative to the PyAEDT installation.
265+
If you're not in a development environment, you may need to navigate to the correct directory first.
266+
267+
268+
Get help
269+
--------
270+
271+
For detailed help on any command:
272+
273+
.. code-block:: bash
274+
275+
pyaedt --help
276+
pyaedt start --help
277+
pyaedt stop --help
278+
pyaedt config test --help
279+
280+
For more information, visit the PyAEDT documentation or GitHub repository.

doc/source/Getting_started/index.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ Getting started
3232
Launch PyAEDT on a client machine and control Electronics Desktop
3333
on a remote server.
3434

35+
.. grid-item-card:: Command line interface
36+
:link: Cli
37+
:link-type: doc
38+
:margin: 2 2 0 0
39+
40+
Learn how to use the PyAEDT command line interface (CLI) for managing AEDT processes.
41+
3542
.. grid-item-card:: Versions and interfaces
3643
:link: versioning
3744
:link-type: doc

doc/styles/config/vocabularies/ANSYS/accept.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,9 @@ refdes
131131
gnd
132132
uv
133133
venv
134+
[Cc][Ll][Ii]
135+
[Pp]ytest
136+
[Tt]yper
137+
subprocess
138+
PID
139+
[Pp]rocesses

0 commit comments

Comments
 (0)