infrahub-sdk package and can be installed using pip or uv.
Requirements
- Python 3.12 or 3.13
- Access to an Infrahub instance (API endpoint)
Installation Methods
Using pip
Install the SDK using pip:Using uv (Recommended)
uv is a fast Python package installer. Install with uv:From Source
To install from the source repository:Verify Installation
Verify the SDK is installed correctly:infrahubctl command-line tool:
Dependencies
The SDK includes the following key dependencies:- httpx - Async HTTP client for API requests
- pydantic - Data validation and settings management
- rich - Beautiful terminal output
- typer - CLI framework
- pyarrow - Data serialization
Development Installation
For SDK development, install with development dependencies:- Testing tools (pytest, pytest-asyncio)
- Linting tools (ruff, mypy)
- Type stubs
Environment Setup
Configuration File
Create aninfrahub.toml configuration file:
Environment Variables
Alternatively, use environment variables:Docker
Use the SDK in a Docker container:Upgrading
Upgrade to the latest version:Compatibility
The SDK version should match your Infrahub server version:| SDK Version | Infrahub Version | Python Version |
|---|---|---|
| 1.7.x | 1.7.x | 3.12, 3.13 |
| 1.6.x | 1.6.x | 3.12 |
Troubleshooting
Import Errors
If you encounter import errors:Version Mismatch
If you see API compatibility errors, verify versions match:Next Steps
Quick Start
Start using the SDK with a quick example