Python SDK for the Basilica GPU rental network
Project description
Basilica Python SDK
Python bindings for the Basilica GPU rental network SDK.
Installation
From PyPI (Recommended)
pip install basilica-sdk
From Source
# Using uv (recommended)
uv pip install -e crates/basilica-sdk-python
# Or using pip with maturin
pip install maturin
cd crates/basilica-sdk-python
maturin develop
Upgrading
pip install --upgrade basilica-sdk
Quick Start
The SDK provides a simple, intuitive interface for managing GPU rentals. With automatic environment variable detection and sensible defaults, you can get started with minimal configuration.
For complete working examples, see the examples/ directory:
quickstart.py- Minimal example to get started quicklystart_rental.py- Full rental workflow with SSH setuplist_nodes.py- Finding available GPU resourceshealth_check.py- API health monitoringssh_utils.py- SSH credential handling examples
Features
🚀 Auto-Configuration
- Automatically detects environment variables:
BASILICA_API_URL- API endpoint URL (default:https://api.basilica.ai)BASILICA_API_TOKEN- Your API token for authentication
- SSH keys auto-detected from
~/.ssh/basilica_ed25519.pubby default - Sensible defaults for all parameters
🔐 Enhanced SSH Handling
- Built-in SSH utilities for credential parsing and command generation
- Automatic SSH key detection and validation
- Formatted SSH connection instructions with error handling
🎯 Simplified API
The SDK provides both minimal and customizable approaches to starting rentals. You can use all defaults for quick starts or specify exactly what you need. See the examples directory for detailed usage patterns and API documentation.
Examples
All code examples are available in the examples/ directory. These provide complete, runnable demonstrations of the SDK's capabilities:
Available Examples
quickstart.py- Get started with minimal code, demonstrating the simplest way to rent a GPUstart_rental.py- Complete rental workflow including custom configuration, SSH setup, and resource managementlist_nodes.py- Query and filter available GPU nodes based on your requirementshealth_check.py- Monitor API health and availabilityssh_utils.py- Work with SSH credentials, including parsing, formatting, and connection management
Each example is fully documented and can be run directly after installing the SDK. They demonstrate best practices and common patterns for working with the Basilica GPU rental network.
Development
Building from Source
# Clone the repository
git clone https://github.com/basilica/basilica.git
cd basilica/crates/basilica-sdk-python
# Create virtual environment
uv venv
source .venv/bin/activate
# Build and install
uv pip install -e .
# Run tests
pytest tests/
Environment Variables
The SDK automatically detects these environment variables:
BASILICA_API_URL: API endpoint (default:https://api.basilica.ai)BASILICA_API_TOKEN: Your API token for authentication
Authentication
To use the SDK, you need to create an API token via the Basilica CLI:
# Create a new API token
basilica tokens create
# The command will output the token - set it as an environment variable
export BASILICA_API_TOKEN="basilica_..."
# Or pass it directly to the client
client = BasilicaClient(api_key="basilica_...")
SSH Key Configuration
By default, SDK looks for keys at ~/.ssh/basilica_ed25519.pub.
To set up SSH keys for Basilica:
# Generate a Basilica-specific ED25519 SSH key
ssh-keygen -t ed25519 -f ~/.ssh/basilica_ed25519
# The public key will be auto-detected by the SDK
ls ~/.ssh/basilica_ed25519.pub
License
MIT OR Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file basilica_sdk-0.4.0.tar.gz.
File metadata
- Download URL: basilica_sdk-0.4.0.tar.gz
- Upload date:
- Size: 1.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51a3cab1bc69fb7d2dd90eb08ba05fc68baf57726c2fb6b68ffeb863bc807f8e
|
|
| MD5 |
00bb1ff045aa18cc70667ef7215f1cef
|
|
| BLAKE2b-256 |
c8233c0516257a7517d4e2177616e05692a288cd20b68007d49e2aaa21fa41d4
|
Provenance
The following attestation bundles were made for basilica_sdk-0.4.0.tar.gz:
Publisher:
release-python-sdk.yml on one-covenant/basilica
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
basilica_sdk-0.4.0.tar.gz -
Subject digest:
51a3cab1bc69fb7d2dd90eb08ba05fc68baf57726c2fb6b68ffeb863bc807f8e - Sigstore transparency entry: 692345138
- Sigstore integration time:
-
Permalink:
one-covenant/basilica@6b6316eb63bddab15be2f7e152652dcb792e0e1b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/one-covenant
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python-sdk.yml@6b6316eb63bddab15be2f7e152652dcb792e0e1b -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file basilica_sdk-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: basilica_sdk-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 3.7 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c440ad821ea64fcfdf94b9136c89a2b877a3523ba24d6e5d0b47afe72bd39dc6
|
|
| MD5 |
c0158e30a34dc7c9df8ee4aec920aa1c
|
|
| BLAKE2b-256 |
022ca68e779322ef6967fb017e3ff79848f91a5db95576e97e6843f0816eee23
|
Provenance
The following attestation bundles were made for basilica_sdk-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release-python-sdk.yml on one-covenant/basilica
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
basilica_sdk-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
c440ad821ea64fcfdf94b9136c89a2b877a3523ba24d6e5d0b47afe72bd39dc6 - Sigstore transparency entry: 692345139
- Sigstore integration time:
-
Permalink:
one-covenant/basilica@6b6316eb63bddab15be2f7e152652dcb792e0e1b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/one-covenant
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python-sdk.yml@6b6316eb63bddab15be2f7e152652dcb792e0e1b -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file basilica_sdk-0.4.0-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: basilica_sdk-0.4.0-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80ecb3023d373d4658a7ac7e1033e40da146410bfce3638dc9468c9d47e8df11
|
|
| MD5 |
1533aa45a84ea160aa1358324876b1fb
|
|
| BLAKE2b-256 |
cfa830f09e6aca54bcd923198dd104ffb07e023d957063ea7a8bbb68b285e84f
|
Provenance
The following attestation bundles were made for basilica_sdk-0.4.0-cp310-abi3-macosx_11_0_arm64.whl:
Publisher:
release-python-sdk.yml on one-covenant/basilica
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
basilica_sdk-0.4.0-cp310-abi3-macosx_11_0_arm64.whl -
Subject digest:
80ecb3023d373d4658a7ac7e1033e40da146410bfce3638dc9468c9d47e8df11 - Sigstore transparency entry: 692345144
- Sigstore integration time:
-
Permalink:
one-covenant/basilica@6b6316eb63bddab15be2f7e152652dcb792e0e1b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/one-covenant
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python-sdk.yml@6b6316eb63bddab15be2f7e152652dcb792e0e1b -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file basilica_sdk-0.4.0-cp310-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: basilica_sdk-0.4.0-cp310-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.10+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f8b1f0d0556bef30cc93c36ee7169fbffd14bdac21d8793aa39ae8a17f79840
|
|
| MD5 |
4c76b5d3fadaf3132a72a8038fed99cf
|
|
| BLAKE2b-256 |
fe11698665095ab5eb3b634a752f8663ae3912d44f54262692cc541aae1e9d84
|
Provenance
The following attestation bundles were made for basilica_sdk-0.4.0-cp310-abi3-macosx_10_12_x86_64.whl:
Publisher:
release-python-sdk.yml on one-covenant/basilica
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
basilica_sdk-0.4.0-cp310-abi3-macosx_10_12_x86_64.whl -
Subject digest:
3f8b1f0d0556bef30cc93c36ee7169fbffd14bdac21d8793aa39ae8a17f79840 - Sigstore transparency entry: 692345147
- Sigstore integration time:
-
Permalink:
one-covenant/basilica@6b6316eb63bddab15be2f7e152652dcb792e0e1b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/one-covenant
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python-sdk.yml@6b6316eb63bddab15be2f7e152652dcb792e0e1b -
Trigger Event:
workflow_dispatch
-
Statement type: