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.17.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.17.tar.gz.
File metadata
- Download URL: depot_client-0.0.17.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 |
6765c90c82d57d9732ccecb525539a603539087d948276fcb347af4caae8339f
|
|
| MD5 |
54c15a427fd1eb738364e4f218f43515
|
|
| BLAKE2b-256 |
801443206e8603e1e027e837be967137abec40c963aac2e4017ec7537e934971
|
File details
Details for the file depot_client-0.0.17-py3-none-any.whl.
File metadata
- Download URL: depot_client-0.0.17-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 |
e3b6830e7b0cfe65878a4c87d5ad06e3a4a645a2c0dc85b433c86b0508ec02cc
|
|
| MD5 |
f890be6e36f3dd3cc52bab699d5504e1
|
|
| BLAKE2b-256 |
972a5023c8a454f6b7bb076625165187f84567fdabc10720b22be67a84eacf04
|