Python client for depot.dev API
Project description
depot-client
A Python client library for interacting with the Depot API, supporting both synchronous and asynchronous operations.
Installation
pip install depot-client
Usage
Buildkit
Synchronous Client
from depot_client import Client
with Client(token=DEPOT_API_TOKEN) as client:
with client.create_endpoint(project_id=PROJECT_ID, platform="amd64") as endpoint:
# Write certificates to files
with open("client.crt", "w") as f:
f.write(endpoint.cert)
with open("client.key", "w") as f:
f.write(endpoint.key)
with open("ca.crt", "w") as f:
f.write(endpoint.ca_cert)
# Use with buildctl
# buildctl --addr endpoint.endpoint \
# --tlscacert ca.crt \
# --tlscert client.crt \
# --tlskey client.key \
# build --frontend dockerfile.v0
Asynchronous Client
import aiofiles
from depot_client import AsyncClient
async def main():
async with AsyncClient(token=DEPOT_API_TOKEN) as client:
async with await client.create_endpoint(project_id=PROJECT_ID) as endpoint:
# Write certificates to files
async with aiofiles.open("client.crt", "w") as f:
await f.write(endpoint.cert)
async with aiofiles.open("client.key", "w") as f:
await f.write(endpoint.key)
async with aiofiles.open("ca.crt", "w") as f:
await f.write(endpoint.ca_cert)
# Use with buildctl
# buildctl --addr endpoint.endpoint \
# --tlscacert ca.crt \
# --tlscert client.crt \
# --tlskey client.key \
# build --frontend dockerfile.v0
asyncio.run(main())
Features
- Synchronous and asynchronous APIs
- Easy BuildKit endpoint creation
- Python bindings for depot's gRPC as well as friendly pythonic wrappers
API Reference
Client Methods
create_endpoint(project_id, platform=None): Create a BuildKit endpointlist_projects(): Get available projectscreate_build(project_id): Create a new buildfinish_build(build_id, error=None): Complete a buildshare_build(build_id): Share a buildstop_sharing_build(build_id): Stop sharing a buildget_build(build_id): Get build informationlist_builds(project_id): List project builds
Environment Variables
DEPOT_API_TOKEN: Your Depot API token for authentication
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
depot_client-0.0.16.tar.gz
(25.7 kB
view details)
Built Distribution
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 depot_client-0.0.16.tar.gz.
File metadata
- Download URL: depot_client-0.0.16.tar.gz
- Upload date:
- Size: 25.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c31996e1f60a0e6db9f70df3008f08fce65fa8793647f7ff92ab4c465efd818c
|
|
| MD5 |
20dda964e7e9045dc82851f024ea8e65
|
|
| BLAKE2b-256 |
5d616aec53244be1a539635b90555b1d9bf8af9ccd0d28df4e7884010a54f078
|
File details
Details for the file depot_client-0.0.16-py3-none-any.whl.
File metadata
- Download URL: depot_client-0.0.16-py3-none-any.whl
- Upload date:
- Size: 30.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28952eaa04f6519f437c53eec4cc9225c96b03c69b0826715e203b03db1f5346
|
|
| MD5 |
00ec537d3be11201730e8275510bdc06
|
|
| BLAKE2b-256 |
c598455356c038190b5146b6f285fa0c40dadab0e0c1bbee994fa267bd45b062
|