PySpeos
is a Python library that gathers functionalities and tools based on remote API of Ansys software Speos .
Installation can be done using the published package or the repository sources.
Warning
Release is in progress. It might take some time before it becomes available. Until then, please use Sources.
This repository is deployed as the Python packages ansys-speos-core. As usual, installation is done by running:
pip install ansys-speos-core
Prerequisite: user needs to have a GitHub account and a valid Personal Access Token (see GitHub Settings/Developer settings/Personal access tokens/Generate new token).
git clone https://github.com/ansys/pyspeos.git
cd pyspeos
python -m pip install --upgrade pip
pip install -U pip tox
tox -e style
pip install -e .
All sources are located in src/ folder.
from ansys.speos.core.speos import Speos
speos = Speos(host="localhost", port=50098)
Documentation for the latest stable release of PySpeos is hosted at PySpeos Documentation.
In the upper right corner of the documentation's title bar, there is an option for switching from viewing the documentation for the latest stable release to viewing the documentation for the development version or previously released versions.
On the PySpeos Issues page, you can create issues to report bugs and request new features. On the PySpeos Discussions page or the Discussions page on the Ansys Developer portal, you can post questions, share ideas, and get community feedback.
To reach the project support team, email pyansys.core@ansys.com.
The documentation sources are stored in doc folder and generated using Sphinx. To build it manually :
pip install -U pip tox
pip install .[doc]
tox -e doc && your_browser_name .tox/doc_out/index.html
Tests and assets are in tests and tests/assets folder. Running PySpeos tests requires a running SpeosRPC server. A configuration file allows to choose between a local server and a Docker server (by default).
The configuration file tests/local_config.json located in tests folder contains several parameters that can be changed according to your needs, for example:
- SpeosServerOnDocker (Boolean): Speos server launched in a Docker container.
- SpeosServerPort (integer): Port used by Speos server for HTTP transfer.
The first option is to use the Docker image from the PySpeos repository on Github.
Note
This option is only available for users with write access to the repository or who are members of the Ansys organization.
Use a GitHub personal access token with permission for reading packages to authorize Docker to access this repository. For more information, see Managing your personal access tokens in the GitHub documentation. Save the token to a file with this command:
echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX > GH_TOKEN.txt
Since the Docker image contains no license server, you will need to enter your license server IP address in the LICENSE_SERVER environment variable. Then, to launch SpeosRPC server with product version 2025.1, you can run:
export GH_USERNAME=<my-github-username>
export LICENSE_SERVER=1055@XXX.XXX.XXX.XXX
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 50098:50098 -e ANSYSLMD_LICENSE_FILE=$LICENSE_SERVER --entrypoint /app/SpeosRPC_Server.x ghcr.io/ansys/speos-rpc:251
Note
To use the latest image in development, you can use ghcr.io/ansys/speos-rpc:dev.
On the other hand, the SpeosRPC server can be started locally.
For Windows:
%AWP_ROOT251%\Optical Products\SPEOS_RPC\SpeosRPC_Server.exe
For Linux:
$AWP_ROOT251\OpticalProducts\SPEOS_RPC\SpeosRPC_Server.x
And test configuration file tests/local_config.json must be updated to use local server:
{
"SpeosServerOnDocker": false,
"SpeosContainerName" : "speos-rpc",
"SpeosServerPort": 50098
}
pip install .[tests]
pytest -vx
pip install .[jupyter]
jupyter notebook
jupyter notebook can be downloaded from the documentations example section.
PySpeos is licensed under the MIT license. The full license can be found in the root directory of the repository, see LICENSE.