Skip to main content

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

API Reference

Client Methods

  • create_endpoint(project_id, platform=None): Create a BuildKit endpoint
  • list_projects(): Get available projects
  • create_build(project_id): Create a new build
  • finish_build(build_id, error=None): Complete a build
  • share_build(build_id): Share a build
  • stop_sharing_build(build_id): Stop sharing a build
  • get_build(build_id): Get build information
  • list_builds(project_id): List project builds

Environment Variables

  • DEPOT_API_TOKEN: Your Depot API token for authentication

Project details


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

depot_client-0.0.16-py3-none-any.whl (30.5 kB view details)

Uploaded Python 3

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

Hashes for depot_client-0.0.16.tar.gz
Algorithm Hash digest
SHA256 c31996e1f60a0e6db9f70df3008f08fce65fa8793647f7ff92ab4c465efd818c
MD5 20dda964e7e9045dc82851f024ea8e65
BLAKE2b-256 5d616aec53244be1a539635b90555b1d9bf8af9ccd0d28df4e7884010a54f078

See more details on using hashes here.

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

Hashes for depot_client-0.0.16-py3-none-any.whl
Algorithm Hash digest
SHA256 28952eaa04f6519f437c53eec4cc9225c96b03c69b0826715e203b03db1f5346
MD5 00ec537d3be11201730e8275510bdc06
BLAKE2b-256 c598455356c038190b5146b6f285fa0c40dadab0e0c1bbee994fa267bd45b062

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page