Skip to content

Installing kolena#

Testing on Kolena is conducted using the kolena Python package. You use the client to create and run tests from your infrastructure that can be explored in our web platform.

kolena is released under the open-source Apache-2.0 license. The package is hosted on PyPI and can be installed using your preferred Python package manager.

Installation#

The first step to start testing with Kolena is to install kolena. Client builds can be installed directly from PyPI using any Python package manager such as pip or Poetry:

pip install kolena
poetry add kolena

Note

Kolena uses pydantic for data validation, but is compatible only with pydantic V1. Prior to 0.76.0, the kolena client did not set an upper bound on compatible pydantic version, and as a result, fresh installations of older versions of kolena may install incompatible version of pydantic, resulting in errors such as:

AttributeError: type object 'SingleProcessResponse' has no attribute '__pydantic_model__'

If you see the error above, please install the latest version of kolena.

Extra Dependency Groups#

Certain metrics computation functionality depends on additional packages like scikit-learn. These extra dependencies can be installed via the metrics group:

pip install 'kolena[metrics]'
poetry add 'kolena[metrics]'

Initialization#

Once you have kolena installed, initialize a session with kolena.initialize(token).

From the Developer page, generate an API token and set the KOLENA_TOKEN environment variable:

export KOLENA_TOKEN="********"

With the KOLENA_TOKEN environment variable set, initialize a client session:

import os
import kolena

kolena.initialize(os.environ["KOLENA_TOKEN"], verbose=True)

By default, sessions have static scope and persist until the interpreter is exited. Additional logging can be configured by specifying initialize(..., verbose=True).

Tip: logging

Integrate kolena into your existing logging system by filtering for events from the "kolena" logger. All log messages are emitted as both Python standard library logging events as well as stdout/stderr messages.

Supported Python Versions#

kolena is compatible with all active Python versions.

Python Version Compatible kolena Versions
3.11 ≥0.69
3.10 All Versions
3.9 All Versions
3.8 All Versions
3.7 All Versions
3.6 (EOL: December 2021) ≤0.46