PyAnsys Shared Components#

As part of the PyAnsys project to enable the usage of Ansys products through Python, we have created shared components that are reusable across the different packages.

These shared components are not interfaces to specific products nor single-purpose tools. They are libraries to facilitate code-sharing within the PyAnsys project.

These are expanding and developing libraries. Feel free to post issues on the various GitHub pages referenced at the end of this document. For additional support, contact PyAnsys Support, who will correctly route your requests to the appropriate development teams.

OpenAPI Common Library#

The openapi-common repository provides the source code for authentication-aware clients for OpenAPI client libraries.

The PyAnsys Open API Common library is intended for use with the custom code generation template in the PyAnsys project. This library currently supports authentication with Basic, Negotiate, NTLM, and OpenID Connect. Most features of the underlying requests session are exposed for use. Some basic configuration is also provided by default.


Install openapi-common with:

pip install ansys-openapi-common


The package exposes several classes, including a client ApiClient and a builder ApiClientFactory that allow a client library to configure a connection to an API.

The ApiClient class is intended to be wrapped by code that implements a client library.

Authentication is configured through the ApiClientFactory object and its with_credentials(), with_autologon(), and with_oidc() methods. If no authentication is required, you can use the with_anonymous() method. You can provide additional configuration with the SessionConfiguration object.

>>> from ansys.openapi.common import ApiClientFactory
>>> session = ApiClientFactory('')
...           .with_autologon()
...           .connect()
<ApiClient url:>