Skip to main content

PyOptiSLang

PyAnsys Python pypi PyPIact GH-CI Codecov MIT Black

Overview

PyOptiSLang is a Python wrapper for Ansys optiSLang. It supports Pythonic access to Ansys optiSLang to be able to communicate with Ansys optiSLang directly from Python. The latest ansys-optislang package provides these capabilities:

  • Start and manage local instances of Ansys optiSLang

  • Remote connections to Ansys optiSLang instances via TCP/IP

  • Create new Ansys optiSLang projects

  • Open existing Ansys optiSLang projects

  • Control Ansys optiSLang project execution

  • Save Ansys optiSLang projects

  • Execute Ansys optiSLang Python API scripts on backend side

  • Evaluate designs on root project level

  • Create and connect nodes

Documentation and issues

For comprehensive information on PyOptiSLang, see the latest release documentation. On the PyOptiSLang Issues page, you can create issues to submit questions, report bugs, and request new features. This is the best place to post questions and code.

Installation

The ansys-optislang-core package supports Python 3.12 through 3.14 on Windows and Linux. Three modes of installation are available:

  • User installation

  • Developer installation

  • Offline installation

For either a developer or offline installation, consider using a virtual environment.

User installation

Install the latest release from PyPi with this command:

pip install ansys-optislang-core

Alternatively, install the latest PyOptiSLang GitHub package with this command:

pip install git+https://github.com/ansys/pyoptislang.git

Developer installation

If you plan on doing local development with GitHub, clone and install PyOptiSLang with this code:

git clone https://github.com/ansys/pyoptislang.git
cd pyoptislang
pip install -e .

A developer installation allows you to edit ansys-optislang-core files locally. Any changes that you make are reflected in your setup after restarting the Python kernel.

Offline installation

Using a wheelhouse can be helpful if you work for a company that restricts access to external networks. From the Releases page in the PyOptiSLang repository, you can find the wheelhouses for a particular release in its assets and download the wheelhouse corresponding to your setup.

You can then install PyOptiSLang and all of its dependencies from one single entry point that can be shared internally, which eases the security review of the PyOptiSLang package content.

For example, on Linux with Python 3.12, unzip the wheelhouse and install PyOptiSLang with code like this:

unzip PyOptiSLang-v0.1.0-wheelhouse-Linux-3.12.zip wheelhouse
pip install ansys-optislang-core -f wheelhouse --no-index --upgrade --ignore-installed

If you’re on Windows with Python 3.12, unzip the wheelhouse to a wheelhouse directory and then install using the same pip command as in the preceding Linux code example.

Dependencies

You must have a local licensed copy or a remote instance of optiSLang installed. The first supported version is 2023 R1.

Getting started

Using the Optislang class, you can either launch optiSLang locally or connect to an already running optiSLang instance. By default, PyOptiSLang uses local domain communication (Named Pipes on Windows and Unix Domain Sockets on Linux) in user scope. For remote connections, TCP/IP communication can be used optionally.

Launch optiSLang locally

For launching optiSLang locally, use the Optislang class without specifying either of the local_server_id or host and port arguments. This launches optiSLang locally and establishes a local domain communication channel. The communication_channel argument can be specified to use remote TCP/IP communication if desired. Other parameters can optionally be specified.

from ansys.optislang.core import Optislang

osl = Optislang()
osl.dispose()

Connect to an already running optiSLang instance

For connection to an already running optiSLang instance, you must specify either of the local_server_id or host and port arguments. Arguments related to the execution of a new optiSLang instance are ignored in this case.

from ansys.optislang.core import Optislang

host = "127.0.0.1"
port = 5310
osl = Optislang(host=host, port=port)
osl.dispose()

Basic usage

This code shows how to launch optiSLang locally, open and run a Python script file, save the results to a new project, and then close the connection:

from ansys.optislang.core import Optislang

osl = Optislang()
file_path = r"C:\Users\Username\my_scripts\myscript.py"
osl.application.project.run_python_file(path=file_path)
osl.application.save_copy("MyNewProject.opf")
osl.dispose()

License and acknowledgments

PyOptiSLang is licensed under the MIT license.

PyOptiSLang makes no commercial claim over Ansys whatsoever. This library extends the functionality of Ansys optiSLang by adding a Python interface to optiSLang without changing the core behavior or license of the original software. The use of the interactive control of PyOptiSLang requires a legally licensed local copy of optiSLang.

For more information on optiSLang, see the Ansys optiSLang page on the Ansys website.

Metadata

Release files for ansys-optislang-core 1.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ansys-optislang-core 1.7.0
File Size Uploaded
ansys_optislang_core-1.7.0.tar.gz 791.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ansys-optislang-core 1.7.0
File Interpreter ABI Platform
ansys_optislang_core-1.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.6 MB

Release files / ansys_optislang_core-1.7.0.tar.gz

Download URL ansys_optislang_core-1.7.0.tar.gz
Size 791.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a31fa71ffe0f19d2753a5d1a931516807c38a17c999bcca37305a45dd0da43b8
BLAKE2b-256 checksum
How to use checksums
87e7a1d9a2d60c819ce2684273fb29bdbf20490e211ddc777788b0b979f1f6db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release files / ansys_optislang_core-1.7.0-py3-none-any.whl

Download URL ansys_optislang_core-1.7.0-py3-none-any.whl
Size 854.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4b992df7ac561f1403d095a48d0858f24b3fbc6b951243c59bb030bce719ccd
BLAKE2b-256 checksum
How to use checksums
c771c383a95c213671a60e981cff989c341c08577f88918b6584a9d47598e54f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.7.0 This release

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.10.0

2 release files

0.9.4

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page