A Python client library for interacting with the Depot API, supporting both synchronous and asynchronous operations.
pip install depot-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 \
# --tlsservername endpoint.server_name \
# --tlscacert ca.crt \
# --tlscert client.crt \
# --tlskey client.key \
# build --frontend dockerfile.v0
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 \
# --tlsservername endpoint.server_name \
# --tlscacert ca.crt \
# --tlscert client.crt \
# --tlskey client.key \
# build --frontend dockerfile.v0
asyncio.run(main())
- Synchronous and asynchronous APIs
- Easy BuildKit endpoint creation
- Python bindings for depot's gRPC as well as friendly pythonic wrappers
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
DEPOT_API_TOKEN
: Your Depot API token for authentication