Installing infrahub-sdk
The Infrahub SDK for Python is available on PyPI and can be installed using the pip package installer. It is recommended to install the SDK into a virtual environment.
python3 -m venv .venv
source .venv/bin/activate
pip install infrahub-sdk
Installing optional extras
Extras can be installed as part of the Python SDK and are not installed by default.
ctl
The ctl extra provides the infrahubctl command, which allows you to interact with an Infrahub instance.
pip install 'infrahub-sdk[ctl]'
testing
The testing extra provides the components for the testing framework of Transforms, Queries and Checks. It installs pytest and enables the bundled pytest-infrahub plugin, which discovers the infrahub_tests blocks in your repository's .infrahub.yml and turns them into test cases.
pip install 'infrahub-sdk[testing]'
testcontainers
The testcontainers extra provides infrahub_sdk.testing.docker, which starts a real Infrahub in containers so your tests can run against a live instance rather than mocked responses. Inherit TestInfrahubDockerClient to get a client connected to that instance.
pip install 'infrahub-sdk[testcontainers]'
This extra is considerably larger than the others, since running Infrahub in containers pulls in Docker, FastAPI and Prefect client libraries. Install testing on its own if you only need to test Transforms, Queries and Checks.
all
Installs infrahub-sdk together with all the extras.
pip install 'infrahub-sdk[all]'