Getting started#

Software requirements#

The ansys.openapi.common package currently supports Python version 3.10 through 3.13.

Installation#

To install the latest OpenAPI-Common release from PyPI, run this command:

pip install ansys-openapi-common

Alternatively, to install the latest development version from the OpenAPI-Common repository, run this command:

pip install git+https://github.com/ansys/openapi-common.git

To install a local development version with Git and Poetry, run these commands:

git clone https://github.com/ansys/openapi-common
cd openapi-common
poetry install

The preceding commands install the package in development mode so that you can modify it locally. Your changes are reflected in your Python setup after restarting the Python kernel.

Brief example#

This brief example demonstrates how the client works:

>>> from ansys.openapi.common import ApiClientFactory
>>> client = ApiClientFactory("https://my-api.com")
...          .with_autologon()
...          .connect()
>>> print(client)

<ApiClient url: http://my-api.com>

The client is now ready and available for use with an OpenAPI client.

Platform-specific Kerberos configuration#

Kerberos authentication should be supported wherever the MIT or Heimdal Kerberos client can be installed. OpenAPI-Common has been tested on the platforms that follow. If you manage to use it on another platform, consider contributing installation steps for your platform by making a pull request.

Ubuntu 20.04#

Ubuntu requires the gssapi Python module to be built from source. This requires the Kerberos headers, Python headers for the version of Python that you are using, and a supported compiler. (GCC works well.)

You should then be able to install this module with the [linux-kerberos] extra:

sudo apt install build-essentials python3.8-dev libkrb5-dev
pip install ansys-openapi-common[linux-kerberos]

Once the installation completes, ensure that your krb5.conf file is set up correctly for your Kerberos configuration and that you have a valid keytab file, which is normally in /etc/krb5.keytab.