2.1. Installing XOA Python API

XOA Python API is available to install and upgrade via the Python Package Index. Alternatively, you can also install and upgrade from the source file.

Note

The minimum Valkyrie release supported by XOA Python API is 83.2.

2.1.1. Prerequisites

Before installing XOA Python API, please make sure your environment has installed Python and pip.

2.1.1.1. Python

XOA Python API requires that you install Python on your system.

Note

XOA Python API requires Python >= 3.8.

2.1.1.2. pip

Make sure pip is installed on your system. pip is the package installer for Python . You can use it to install packages from the Python Package Index and other indexes.

Usually, pip is automatically installed if you are:

If you don’t have pip installed, you can:

Install pip in Windows environment.
> py get-pip.py
Install pip in macOS/Linux environment.
$ python3 get-pip.py

See also

Read more details about this script in pypa/get-pip.

Read more about installation of pip in pip installation.

2.1.2. Installing From PyPI Using pip

pip is the recommended installer for XOA Python API. The most common usage of pip is to install from the Python Package Index using Requirement Specifiers.

Note

If you install XOA Core using pip install xoa-core, XOA Python API (PyPI package name xoa_driver) will be automatically installed.

2.1.2.1. Install to Global Namespace

Install XOA Python API in Windows environment from PyPi.
> pip install xoa-driver            # latest version
> pip install xoa-driver==1.0.7     # specific version
> pip install xoa-driver>=1.0.7     # minimum version
Install XOA Python API in macOS/Linux environment from PyPi.
$ pip install xoa-driver            # latest version
$ pip install xoa-driver==1.0.7     # specific version
$ pip install xoa-driver>=1.0.7     # minimum version

2.1.2.2. Install in Activated Virtual Environment

Install XOA Python API in a virtual environment, so it does not pollute your global namespace.

For example, your project folder is called /my_xoa_project.

Install XOA Python API in a virtual environment in Windows from PyPI.
[my_xoa_project]> python -m venv .\env
[my_xoa_project]> .\env\Scripts\activate

(env) [my_xoa_project]> pip install xoa-driver
Install XOA Python API in a virtual environment in macOS/Linux from PyPI.
[my_xoa_project]$ python3 -m venv ./env
[my_xoa_project]$ source ./env/bin/activate

(env) [my_xoa_project]$ pip install xoa-driver

2.1.2.3. Deactivate Virtual Environment

You can deactivate a virtual environment by typing deactivate in your shell.

Deactivate virtual environment on Windows.
(env) [my_xoa_project]> deactivate
[my_xoa_project]>
Deactivate virtual environment on macOS/Linux.
(env) [my_xoa_project]$ deactivate
[my_xoa_project]$

2.1.3. Upgrading From PyPI Using pip

To upgrade XOA Python API package from PyPI:

Upgrade XOA Python API in Windows environment from PyPi.
> pip install xoa-driver --upgrade
Upgrade XOA Python API in macOS/Linux environment from PyPi.
$ pip install xoa-driver --upgrade

Note

If you upgrade XOA Core using pip install --upgrade xoa-core, XOA Python API (PyPI package name xoa_driver) will be automatically upgraded.

2.1.4. Installing Manually From Source

If for some reason you need to install or upgrade XOA Python API manually from source, the steps are:

Step 1, make sure Python packages wheel and setuptools are installed on your system. Install wheel and setuptools using pip:

Install wheel and setuptools in Windows environment.
> pip install wheel setuptools
Install wheel and setuptools in macOS/Linux environment.
$ pip install wheel setuptools

Step 2, download the XOA Python API source distribution from XOA Python API Releases. Unzip the archive and run the setup.py script to install the package:

Install XOA Python API in Windows environment from source.
[xoa_driver]> python setup.py install
Install XOA Python API in macOS/Linux environment from source.
[xoa_driver]$ python3 setup.py install

Step 3, if you want to distribute, you can build .whl file for distribution from the source:

Build XOA Python API wheel in Windows environment for distribution.
[xoa_driver]> python setup.py bdist_wheel
Build XOA Python API wheel in macOS/Linux environment for distribution.
[xoa_driver]$ python3 setup.py bdist_wheel

Important

If you install XOA Core from the source code, you need to install XOA Python API (PyPI package name xoa_driver) separately. This is because XOA Python API is treated as a 3rd-party dependency of XOA Core. You can go to XOA Python API repository to learn how to install it.

2.1.5. Uninstall and Remove Unused Dependencies

pip uninstall xoa-driver can uninstall the package itself but not its dependencies. Leaving the package’s dependencies in your environment can later create conflicting dependencies problem.

We recommend install and use the pip-autoremove utility to remove a package plus unused dependencies.

Uninstall XOA Python API in Windows environment.
> pip install pip-autoremove
> pip-autoremove xoa-driver -y
Uninstall XOA Python API in macOS/Linux environment.
$ pip install pip-autoremove
$ pip-autoremove xoa-driver -y

See also

See the pip uninstall reference.

See pip-autoremove usage.