Skip to content
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ updates:
groups:
core-deps:
patterns:
- "ansys-tools-path"
- "ansys-tools-common"
- "numpy"
- "comtypes"
grpc-deps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
env:
ANSYSLMD_LICENSE_FILE: 1055@${{ secrets.LICENSE_SERVER }}
run: |
docker run --detach --name speos-rpc -p 127.0.0.1:50098:50098 -e SPEOS_LOG_LEVEL=2 -e ANSYSLMD_LICENSE_FILE=${{ env.ANSYSLMD_LICENSE_FILE }} -v "${{ github.workspace }}/tests/assets:/app/assets" --entrypoint /app/SpeosRPC_Server.x ghcr.io/ansys/speos-rpc:dev --host 0.0.0.0
docker run --detach --name speos-rpc -p 127.0.0.1:50098:50098 -e SPEOS_LOG_LEVEL=2 -e ANSYSLMD_LICENSE_FILE=${{ env.ANSYSLMD_LICENSE_FILE }} -v "${{ github.workspace }}/tests/assets:/app/assets" --entrypoint /app/SpeosRPC_Server.x ghcr.io/ansys/speos-rpc:2025.2.4.35476 --transport_insecure --host 0.0.0.0
- name: "Run Ansys documentation building action"
uses: ansys/actions/doc-build@21c9de9bee9692173780696d4a39964f20b9cfa3 # v10.1.5
with:
Expand Down Expand Up @@ -165,7 +165,7 @@ jobs:
ANSYSLMD_LICENSE_FILE: 1055@${{ secrets.LICENSE_SERVER }}
shell: bash
run: |
docker run --detach --name speos-rpc -p 127.0.0.1:50098:50098 -e SPEOS_LOG_LEVEL=2 -e ANSYSLMD_LICENSE_FILE=${{ env.ANSYSLMD_LICENSE_FILE }} -v "${{ github.workspace }}/tests/assets:/app/assets" --entrypoint /app/SpeosRPC_Server.x ghcr.io/ansys/speos-rpc:dev -m 25000000 --host 0.0.0.0
docker run --detach --name speos-rpc -p 127.0.0.1:50098:50098 -e SPEOS_LOG_LEVEL=2 -e ANSYSLMD_LICENSE_FILE=${{ env.ANSYSLMD_LICENSE_FILE }} -v "${{ github.workspace }}/tests/assets:/app/assets" --entrypoint /app/SpeosRPC_Server.x ghcr.io/ansys/speos-rpc:2025.2.4.35476 --transport_insecure -m 25000000 --host 0.0.0.0

- name: Run pytest
shell: bash
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
speos-version: ["251", "252", "dev"]
speos-version: ["251", "252", "dev", "2025.2.4.35476"]
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

Expand Down Expand Up @@ -61,8 +61,12 @@ jobs:

if [[ "$speos_version" == "251" ]]; then
docker run --detach --name speos-rpc -p 127.0.0.1:50098:50098 -e SPEOS_LOG_LEVEL=2 -e ANSYSLMD_LICENSE_FILE=${{ env.ANSYSLMD_LICENSE_FILE }} -v "${{ github.workspace }}/tests/assets:/app/assets" --entrypoint /app/SpeosRPC_Server.x ghcr.io/ansys/speos-rpc:$speos_version -m 25000000
else
elif [[ "$speos_version" == "252" ]]; then
docker run --detach --name speos-rpc -p 127.0.0.1:50098:50098 -e SPEOS_LOG_LEVEL=2 -e ANSYSLMD_LICENSE_FILE=${{ env.ANSYSLMD_LICENSE_FILE }} -v "${{ github.workspace }}/tests/assets:/app/assets" --entrypoint /app/SpeosRPC_Server.x ghcr.io/ansys/speos-rpc:$speos_version -m 25000000 --host 0.0.0.0
elif [[ "$speos_version" == "dev" ]]; then
docker run --detach --name speos-rpc -p 127.0.0.1:50098:50098 -e SPEOS_LOG_LEVEL=2 -e ANSYSLMD_LICENSE_FILE=${{ env.ANSYSLMD_LICENSE_FILE }} -v "${{ github.workspace }}/tests/assets:/app/assets" --entrypoint /app/SpeosRPC_Server.x ghcr.io/ansys/speos-rpc:$speos_version -m 25000000 --host 0.0.0.0
elif [[ "$speos_version" == "2025.2.4.35476" ]]; then
docker run --detach --name speos-rpc -p 127.0.0.1:50098:50098 -e SPEOS_LOG_LEVEL=2 -e ANSYSLMD_LICENSE_FILE=${{ env.ANSYSLMD_LICENSE_FILE }} -v "${{ github.workspace }}/tests/assets:/app/assets" --entrypoint /app/SpeosRPC_Server.x ghcr.io/ansys/speos-rpc:$speos_version -m 25000000 --transport_insecure--host 0.0.0.0
fi

- name: Run pytest for Speos ${{ matrix.speos-version }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ _autosummary

# Testing
.coverage
.cov/
.tox/
*,cover
test-output.xml
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ All sources are located in `<src/>`_ folder.

from ansys.speos.core.speos import Speos

speos = Speos(host="localhost", port=50098)
speos = Speos()

Documentation and issues
------------------------
Expand Down Expand Up @@ -143,7 +143,7 @@ Then, to launch SpeosRPC server with product version 2025.1, you can run:

cat GH_TOKEN.txt | docker login ghcr.io -u "$GH_USERNAME" --password-stdin
docker pull ghcr.io/ansys/speos-rpc:251
docker run --detach --name speos-rpc -p 127.0.0.1:50098:50098 -e ANSYSLMD_LICENSE_FILE=$LICENSE_SERVER --entrypoint /app/SpeosRPC_Server.x ghcr.io/ansys/speos-rpc:251
docker run --detach --name speos-rpc -p 127.0.0.1:50098:50098 -e ANSYSLMD_LICENSE_FILE=$LICENSE_SERVER --entrypoint /app/SpeosRPC_Server.x ghcr.io/ansys/speos-rpc:251 --transport_insecure

.. note::

Expand Down
1 change: 1 addition & 0 deletions doc/changelog.d/783.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use grpc secure channel
5 changes: 2 additions & 3 deletions doc/source/cheat_sheet/cheat_sheet_script.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,12 @@ speos_server = launch_local_speos_rpc_server()
# returns a connected speos instance
```

Connect to an existing instance:
Connect to the existing server instance:

```{python}
#| eval: false
from ansys.speos.core import Speos
host_ip = '127.0.0.1' # localhost here
speos_server = Speos(host=host_ip, port=50098)
speos_server = Speos()
```

# Speos Solver files
Expand Down
26 changes: 5 additions & 21 deletions doc/source/getting_started/docker/common_docker.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,21 @@ To use another product version, please modify the image label from `251` to the
.. code-block:: bash

export LICENSE_SERVER="[email protected]"
docker run --detach --name speos-rpc -p 127.0.0.1:50098:50098 -e ANSYSLMD_LICENSE_FILE=$LICENSE_SERVER --entrypoint /app/SpeosRPC_Server.x ghcr.io/ansys/speos-rpc:251
docker run --detach --name speos-rpc -p 127.0.0.1:50098:50098 -e ANSYSLMD_LICENSE_FILE=$LICENSE_SERVER --entrypoint /app/SpeosRPC_Server.x ghcr.io/ansys/speos-rpc:252 --transport_insecure

.. tab-item:: Powershell

.. code-block:: pwsh

$env:LICENSE_SERVER="[email protected]"
docker run --detach --name speos-rpc -p 127.0.0.1:50098:50098 -e ANSYSLMD_LICENSE_FILE=$env:LICENSE_SERVER --entrypoint /app/SpeosRPC_Server.x ghcr.io/ansys/speos-rpc:251
docker run --detach --name speos-rpc -p 127.0.0.1:50098:50098 -e ANSYSLMD_LICENSE_FILE=$env:LICENSE_SERVER --entrypoint /app/SpeosRPC_Server.x ghcr.io/ansys/speos-rpc:252 --transport_insecure

.. tab-item:: Windows CMD

.. code-block:: bash

set LICENSE_SERVER="[email protected]"
docker run --detach --name speos-rpc -p 127.0.0.1:50098:50098 -e ANSYSLMD_LICENSE_FILE=%LICENSE_SERVER% --entrypoint /app/SpeosRPC_Server.x ghcr.io/ansys/speos-rpc:251
docker run --detach --name speos-rpc -p 127.0.0.1:50098:50098 -e ANSYSLMD_LICENSE_FILE=%LICENSE_SERVER% --entrypoint /app/SpeosRPC_Server.x ghcr.io/ansys/speos-rpc:252 --transport_insecure

Connect to the Speos service
----------------------------
Expand All @@ -65,22 +65,6 @@ After the Speos service is launched, connect to it with these commands:

.. code:: python

from ansys.speos.core import Speos
from ansys.speos.core import Speos, default_docker_channel

speos = Speos()

By default, the ``Speos`` instance connects to ``127.0.0.1`` (``"localhost"``) on
port ``50098``.

You can change this by modifying the ``host`` and ``port``
parameters of the ``Speos`` object, but note that you must also modify
your ``docker run`` command by changing the ``<HOST-PORT>-50098`` argument.

The following tabs show the commands that set the environment variables and ``Speos``
function.

.. code:: python

from ansys.speos.core import Speos

speos = Speos(host="127.0.0.1", port=50098)
speos = Speos(channel = default_docker_channel())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
speos = Speos(channel = default_docker_channel())
speos = Speos()
Be aware that such docker is launched via insecure channel
By default, the ``Speos`` instance connects to ``"localhost"`` on
port ``50098``.
You can change this by modifying the ``host`` and ``port``
parameters of ``default_docker_channel``, but note that you must also modify
your ``docker run`` command by changing the ``<HOST-PORT>-50098`` argument.
The following tabs show the commands that set the ``host`` and ``port``
parameters of ``default_docker_channel``.
.. code:: python
from ansys.speos.core import Speos, default_docker_channel
speos = Speos(channel = default_docker_channel(host="127.0.0.1", port=50098))

@etiennearnal @jomadec could you please review this? also, could we provide explanation/an example to launch docker in secure way?

2 changes: 1 addition & 1 deletion doc/source/getting_started/existing/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ From Python, establish a connection to the existing Speos service by creating a

from ansys.speos.core import Speos

speos = Speos(host="127.0.0.1", port=50098)
speos = Speos()

If no error messages are received, your connection is established successfully.

Expand Down
12 changes: 6 additions & 6 deletions examples/core/bsdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@

from ansys.speos.core import Speos
from ansys.speos.core.bsdf import AnisotropicBSDF, BxdfDatapoint
from ansys.speos.core.kernel.client import (
SpeosClient,
default_docker_channel,
)
from ansys.speos.core.launcher import launch_local_speos_rpc_server
from ansys.speos.core.speos import SpeosClient

# -

# ### Define constants
# Constants help ensure consistency and avoid repetition throughout the example.

HOSTNAME = "localhost"
GRPC_PORT = 50098 # Be sure the Speos GRPC Server has been started on this port.
USE_DOCKER = True # Set to False if you're running this example locally as a Notebook.

# ### Define helper functions
Expand Down Expand Up @@ -163,9 +163,9 @@ def create_spectrum(value, w_start=380.0, w_end=780.0, w_step=10):
# be used to start a local instance of the service.

if USE_DOCKER:
speos = Speos(host=HOSTNAME, port=GRPC_PORT)
speos = Speos(channel=default_docker_channel())
else:
speos = launch_local_speos_rpc_server(port=GRPC_PORT)
speos = launch_local_speos_rpc_server()

# ### Create a BXDFDatapoint
# to create a bsdf we need the bsdf for multiple incident angles.
Expand Down
5 changes: 4 additions & 1 deletion examples/core/lpf-preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
from pathlib import Path

from ansys.speos.core import LightPathFinder, Project, Speos, launcher
from ansys.speos.core.kernel.client import (
default_docker_channel,
)
from ansys.speos.core.simulation import SimulationInteractive

# -
Expand Down Expand Up @@ -45,7 +48,7 @@
# be used to start a local instance of the service.

if USE_DOCKER:
speos = Speos(host=HOSTNAME, port=GRPC_PORT)
speos = Speos(channel=default_docker_channel())
else:
speos = launcher.launch_local_speos_rpc_server(port=GRPC_PORT)

Expand Down
5 changes: 4 additions & 1 deletion examples/core/opt-prop.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
from pathlib import Path

from ansys.speos.core import Project, Speos, launcher
from ansys.speos.core.kernel.client import (
default_docker_channel,
)

# -

Expand Down Expand Up @@ -76,7 +79,7 @@ def create_face(body):
# be used to start a local instance of the service.

if USE_DOCKER:
speos = Speos(host=HOSTNAME, port=GRPC_PORT)
speos = Speos(channel=default_docker_channel())
else:
speos = launcher.launch_local_speos_rpc_server(port=GRPC_PORT)

Expand Down
5 changes: 4 additions & 1 deletion examples/core/part.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
from pathlib import Path

from ansys.speos.core import Body, Face, Part, Project, Speos
from ansys.speos.core.kernel.client import (
default_docker_channel,
)
from ansys.speos.core.launcher import launch_local_speos_rpc_server

# -
Expand Down Expand Up @@ -50,7 +53,7 @@
# be used to start a local instance of the service.

if USE_DOCKER:
speos = Speos(host=HOSTNAME, port=GRPC_PORT)
speos = Speos(channel=default_docker_channel())
else:
speos = launch_local_speos_rpc_server(port=GRPC_PORT)

Expand Down
5 changes: 4 additions & 1 deletion examples/core/prism-example.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
from pathlib import Path

from ansys.speos.core import Body, Project, Speos
from ansys.speos.core.kernel.client import (
default_docker_channel,
)
from ansys.speos.core.launcher import launch_local_speos_rpc_server
from ansys.speos.core.sensor import Sensor3DIrradiance, SensorIrradiance
from ansys.speos.core.simulation import SimulationDirect
Expand Down Expand Up @@ -50,7 +53,7 @@
# be used to start a local instance of the service.

if USE_DOCKER:
speos = Speos(host=HOSTNAME, port=GRPC_PORT)
speos = Speos(channel=default_docker_channel())
else:
speos = launch_local_speos_rpc_server(port=GRPC_PORT)

Expand Down
5 changes: 4 additions & 1 deletion examples/core/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
from pathlib import Path

from ansys.speos.core import Project, Speos
from ansys.speos.core.kernel.client import (
default_docker_channel,
)
from ansys.speos.core.launcher import launch_local_speos_rpc_server
from ansys.speos.core.sensor import SensorIrradiance
from ansys.speos.core.simulation import SimulationDirect
Expand Down Expand Up @@ -57,7 +60,7 @@
# be used to start a local instance of the service.

if USE_DOCKER:
speos = Speos(host=HOSTNAME, port=GRPC_PORT)
speos = Speos(channel=default_docker_channel())
else:
speos = launch_local_speos_rpc_server(port=GRPC_PORT)

Expand Down
5 changes: 4 additions & 1 deletion examples/core/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
from pathlib import Path

from ansys.speos.core import GeoRef, Project, Speos, launcher
from ansys.speos.core.kernel.client import (
default_docker_channel,
)
from ansys.speos.core.sensor import (
Sensor3DIrradiance,
SensorCamera,
Expand Down Expand Up @@ -73,7 +76,7 @@ def create_face(body):
# be used to start a local instance of the service.

if USE_DOCKER:
speos = Speos(host=HOSTNAME, port=GRPC_PORT)
speos = Speos(channel=default_docker_channel())
else:
speos = launcher.launch_local_speos_rpc_server(port=GRPC_PORT)

Expand Down
5 changes: 4 additions & 1 deletion examples/core/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
from pathlib import Path

from ansys.speos.core import Project, Speos, launcher
from ansys.speos.core.kernel.client import (
default_docker_channel,
)
from ansys.speos.core.simulation import SimulationInteractive, SimulationInverse

# -
Expand Down Expand Up @@ -50,7 +53,7 @@
# be used to start a local instance of the service..

if USE_DOCKER:
speos = Speos(host=HOSTNAME, port=GRPC_PORT)
speos = Speos(channel=default_docker_channel())
else:
speos = launcher.launch_local_speos_rpc_server(port=GRPC_PORT)

Expand Down
5 changes: 4 additions & 1 deletion examples/core/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
from pathlib import Path

from ansys.speos.core import GeoRef, Project, Speos, launcher
from ansys.speos.core.kernel.client import (
default_docker_channel,
)
from ansys.speos.core.source import (
SourceAmbientNaturalLight,
SourceLuminaire,
Expand Down Expand Up @@ -75,7 +78,7 @@ def create_face(body):
# be used to start a local instance of the service.

if USE_DOCKER:
speos = Speos(host=HOSTNAME, port=GRPC_PORT)
speos = Speos(channel=default_docker_channel())
else:
speos = launcher.launch_local_speos_rpc_server(port=GRPC_PORT)

Expand Down
5 changes: 4 additions & 1 deletion examples/kernel/modify-scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
from ansys.api.speos.sensor.v1 import camera_sensor_pb2

from ansys.speos.core import Speos, launcher
from ansys.speos.core.kernel.client import (
default_docker_channel,
)
from ansys.speos.core.kernel.scene import ProtoScene
from ansys.speos.core.kernel.sensor_template import ProtoSensorTemplate

Expand Down Expand Up @@ -67,7 +70,7 @@
# be used to start a local instance of the service.

if USE_DOCKER:
speos = Speos(host=HOSTNAME, port=GRPC_PORT)
speos = Speos(channel=default_docker_channel())
else:
speos = launcher.launch_local_speos_rpc_server(port=GRPC_PORT)

Expand Down
5 changes: 4 additions & 1 deletion examples/kernel/object-link.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# # How to use an ObjectLink
from ansys.speos.core import launcher
from ansys.speos.core.kernel.client import (
default_docker_channel,
)

# This tutorial demonstrates how to use speos objects in layer core.
# ## What is an ObjectLink?
Expand Down Expand Up @@ -30,7 +33,7 @@
# be used to start a local instance of the service.

if USE_DOCKER:
speos = Speos(host=HOSTNAME, port=GRPC_PORT)
speos = Speos(channel=default_docker_channel())
else:
speos = launcher.launch_local_speos_rpc_server(port=GRPC_PORT)

Expand Down
5 changes: 4 additions & 1 deletion examples/kernel/scene-job.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
import time

from ansys.speos.core import launcher
from ansys.speos.core.kernel.client import (
default_docker_channel,
)
from ansys.speos.core.kernel.job import ProtoJob
from ansys.speos.core.speos import Speos

Expand Down Expand Up @@ -43,7 +46,7 @@
# be used to start a local instance of the service.

if USE_DOCKER:
speos = Speos(host=HOSTNAME, port=GRPC_PORT)
speos = Speos(channel=default_docker_channel())
else:
speos = launcher.launch_local_speos_rpc_server(port=GRPC_PORT)

Expand Down
Loading