Skip to content

Commit 5bfe686

Browse files
Merge branch 'main' into chore/v1_measurement_model_tools
2 parents a66e8ec + 456480d commit 5bfe686

File tree

23 files changed

+759
-55
lines changed

23 files changed

+759
-55
lines changed

.github/workflows/backwards_compatibility.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
persist-credentials: false
5151

5252
- name: Set up Python
53-
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
53+
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
5454
with:
5555
python-version: ${{ env.MAIN_PYTHON_VERSION }}
5656

@@ -171,7 +171,7 @@ jobs:
171171
persist-credentials: false
172172

173173
- name: Set up Python
174-
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
174+
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
175175
with:
176176
python-version: ${{ env.MAIN_PYTHON_VERSION }}
177177

.github/workflows/ci_cd.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ jobs:
215215

216216
- name: Set up Python
217217
if: env.SKIP_UNSTABLE == 'false'
218-
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
218+
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
219219
with:
220220
python-version: ${{ env.MAIN_PYTHON_VERSION }}
221221

@@ -512,7 +512,7 @@ jobs:
512512
persist-credentials: false
513513

514514
- name: Setup Python ${{ matrix.python-version }}
515-
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
515+
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
516516
with:
517517
python-version: ${{ matrix.python-version }}
518518

@@ -564,7 +564,7 @@ jobs:
564564
persist-credentials: false
565565

566566
- name: Setup Python ${{ matrix.python-version }}
567-
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
567+
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
568568
with:
569569
python-version: ${{ matrix.python-version }}
570570

@@ -715,7 +715,7 @@ jobs:
715715
uses: pyvista/setup-headless-display-action@7d84ae825e6d9297a8e99bdbbae20d1b919a0b19 # v4.2
716716

717717
- name: Set up Python
718-
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
718+
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
719719
with:
720720
python-version: ${{ env.MAIN_PYTHON_VERSION }}
721721

@@ -824,7 +824,7 @@ jobs:
824824
persist-credentials: false
825825

826826
- name: Set up Python
827-
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
827+
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
828828
with:
829829
python-version: ${{ env.MAIN_PYTHON_VERSION }}
830830

.github/workflows/nightly_docker_test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ env:
2727
ANSRV_GEO_PORT: 710
2828
ANSRV_GEO_LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
2929
GEO_CONT_NAME: ans_geo_nightly
30+
IS_WORKFLOW_RUNNING: true
3031

3132
concurrency:
3233
group: ${{ github.workflow }}-${{ github.ref }}
@@ -105,7 +106,7 @@ jobs:
105106
persist-credentials: false
106107

107108
- name: Set up Python
108-
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
109+
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
109110
with:
110111
python-version: ${{ env.MAIN_PYTHON_VERSION }}
111112

.github/workflows/v1_testing.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ env:
99
ANSRV_GEO_LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
1010
GEO_CONT_NAME: ans_geo
1111
RESET_IMAGE_CACHE: 0
12+
IS_WORKFLOW_RUNNING: true
1213

1314
permissions:
1415
contents: read
@@ -29,7 +30,7 @@ jobs:
2930
persist-credentials: false
3031

3132
- name: Set up Python
32-
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
33+
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
3334
with:
3435
python-version: ${{ matrix.python-version }}
3536

@@ -104,7 +105,7 @@ jobs:
104105
persist-credentials: false
105106

106107
- name: Set up Python
107-
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
108+
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
108109
with:
109110
python-version: ${{ matrix.python-version }}
110111

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,7 @@ docker/*-binaries.zip
167167
# Ignore scripts folder
168168
scripts
169169

170+
# Ignore certs folder
171+
certs
172+
170173
# End of https://www.toptal.com/developers/gitignore/api/python

doc/changelog.d/2411.added.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Secure grpc channels
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Bump ansys-api-discovery from 1.0.10 to 1.0.14
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Bump actions/setup-python from 6.0.0 to 6.1.0 in the actions group

doc/source/cheatsheet/cheat_sheet.qmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ modeler = launch_modeler(mode='geometry_service')
113113

114114
```{python}
115115
#| output: false
116+
#| eval: false
116117
from ansys.geometry.core import Modeler
117118
modeler = Modeler()
118119
print(modeler)
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
Launching and connecting to a Modeler instance
2+
**********************************************
3+
4+
PyAnsys Geometry provides the ability to launch and connect to a Modeler instance
5+
either locally or remotely. A Modeler instance is a running instance of a
6+
CAD service that the PyAnsys Geometry client can communicate with.
7+
8+
CAD services that are supported include:
9+
10+
- Ansys Geometry Service
11+
- Ansys Discovery
12+
- Ansys SpaceClaim
13+
14+
Connecting to a Modeler instance
15+
--------------------------------
16+
17+
To connect to a Modeler instance, you can use the :class:`Modeler() <ansys.geometry.core.modeler>` class,
18+
which provides methods to connect to the desired CAD service. You can specify the connection parameters such
19+
as the host, port, and authentication details.
20+
21+
.. code:: python
22+
23+
from ansys.geometry.core import Modeler
24+
25+
# Connect to a local Modeler instance
26+
modeler = Modeler(host="localhost", port=12345)
27+
28+
Connection types
29+
----------------
30+
31+
PyAnsys Geometry supports different connection types to connect to a Modeler instance, which
32+
differ in the environment in which the transport takes place:
33+
34+
- **Local connection**: The Modeler instance is running on the same machine as the PyAnsys
35+
Geometry client. This is typically used for development and testing purposes.
36+
- **Remote connection**: The service instance is running on a different machine, and the
37+
Modeler client connects to it over the network. This is useful for accessing
38+
Modeler instances hosted on remote servers or cloud environments.
39+
40+
Securing connections
41+
--------------------
42+
43+
When connecting to a remote Modeler instance, it is important to ensure that the connection
44+
is secure, not only to protect sensitive data but also to comply with organizational
45+
security policies. These secure connections can be established using various methods, such as:
46+
47+
- **mTLS**: Mutual Transport Layer Security (mTLS) is a security protocol that ensures both the client
48+
and server authenticate each other using digital certificates. This provides a high level of
49+
security for the connection. PyAnsys Geometry supports mTLS connections to Modeler instances. In that
50+
case, you need to provide the necessary certificates and keys when establishing the connection. More
51+
information on the certificates needed can be seen in
52+
`Generating certificates for mTLS <https://tools.docs.pyansys.com/version/stable/user_guide/secure_grpc.html#generating-certificates-for-mtls>`_.
53+
Make sure that the names of the files are in line with the previous link. An example of how to set up
54+
an mTLS connection is shown below:
55+
56+
.. note::
57+
58+
mTLS is the default transport mode when connecting to remote Modeler instances.
59+
60+
.. code:: python
61+
62+
from ansys.geometry.core import Modeler, launch_modeler
63+
64+
# OPTION 1: Connect to a Modeler instance using mTLS
65+
modeler = Modeler(
66+
host="remote_host",
67+
port=12345,
68+
transport_mode="mtls",
69+
certs_dir="path/to/certs_directory",
70+
)
71+
72+
# OPTION 2: Launch the Modeler instance locally using mTLS
73+
modeler = launch_modeler(
74+
transport_mode="mtls",
75+
certs_dir="path/to/certs_directory",
76+
)
77+
78+
- **UDS**: Unix Domain Sockets (UDS) provide a way to establish secure connections between
79+
processes on the same machine. UDS connections are faster and more secure than traditional
80+
network connections, as they do not require network protocols. PyAnsys Geometry supports UDS
81+
connections to local Modeler instances (**only on Linux-based services**). An example of how
82+
to set up a UDS connection is shown below:
83+
84+
.. note::
85+
86+
UDS is only supported when connecting to local Modeler instances on Linux-based services.
87+
It is also the default transport mode in such cases.
88+
89+
.. code:: python
90+
91+
from ansys.geometry.core import Modeler, launch_modeler
92+
93+
# OPTION 1: Connect to a local Modeler instance using UDS
94+
modeler = Modeler(host="localhost", port=12345, transport_mode="uds")
95+
96+
# OPTION 2: Launch the Modeler instance locally using UDS and specific directory and id for
97+
# the UDS socket
98+
modeler = Modeler(host="localhost", port=12345, transport_mode="uds", uds_dir="/path/to/uds_directory", uds_id="unique_id")
99+
100+
# OPTION 3: Launch the Modeler instance locally using UDS
101+
modeler = launch_modeler(transport_mode="uds")
102+
103+
# OPTION 4: Launch the Modeler instance locally using UDS and specific directory and id for
104+
# the UDS socket
105+
modeler = launch_modeler(transport_mode="uds", uds_dir="/path/to/uds_directory", uds_id="unique_id")
106+
107+
- **WNUA**: Windows Named User Authentication (WNUA) provides a way to establish secure connections
108+
between processes on the same Windows machine. WNUA connections use a built-in mechanism to verify
109+
that the owner of the service running is also the owner of the client connection established (similar
110+
to UDS). PyAnsys Geometry supports WNUA connections to local Modeler instances
111+
(**only on Windows-based services**). An example of how to set up a WNUA connection is shown below:
112+
113+
.. note::
114+
115+
WNUA is only supported when connecting to local Modeler instances on Windows-based services.
116+
It is also the default transport mode in such cases.
117+
118+
.. code:: python
119+
120+
from ansys.geometry.core import Modeler, launch_modeler
121+
122+
# OPTION 1: Connect to a local Modeler instance using WNUA
123+
modeler = Modeler(host="localhost", port=12345, transport_mode="wnua")
124+
125+
# OPTION 2: Launch the Modeler instance locally using WNUA
126+
modeler = launch_modeler(transport_mode="wnua")
127+
128+
- **Insecure**: Insecure connections do not provide any security measures to protect the data
129+
transmitted between the client and server. This mode is not recommended for production use,
130+
as it exposes the connection to potential security risks. However, it can be useful for
131+
development and testing purposes in trusted environments. An example of how to set up an
132+
insecure connection is shown below:
133+
134+
.. code:: python
135+
136+
from ansys.geometry.core import Modeler, launch_modeler
137+
138+
# OPTION 1: Connect to a Modeler instance using an insecure connection
139+
modeler = Modeler(
140+
host="remote_host",
141+
port=12345,
142+
transport_mode="insecure",
143+
)
144+
145+
# OPTION 2: Launch the Modeler instance locally using an insecure connection
146+
modeler = launch_modeler(
147+
transport_mode="insecure",
148+
)
149+
150+
For more information on secure connections and transport modes, see
151+
`Securing gRPC connections <https://tools.docs.pyansys.com/version/stable/user_guide/secure_grpc.html>`_.

0 commit comments

Comments
 (0)