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.17.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.17-py3-none-any.whl (30.5 kB view details)

Uploaded Python 3

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

Hashes for depot_client-0.0.17.tar.gz
Algorithm Hash digest
SHA256 6765c90c82d57d9732ccecb525539a603539087d948276fcb347af4caae8339f
MD5 54c15a427fd1eb738364e4f218f43515
BLAKE2b-256 801443206e8603e1e027e837be967137abec40c963aac2e4017ec7537e934971

See more details on using hashes here.

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

Hashes for depot_client-0.0.17-py3-none-any.whl
Algorithm Hash digest
SHA256 e3b6830e7b0cfe65878a4c87d5ad06e3a4a645a2c0dc85b433c86b0508ec02cc
MD5 f890be6e36f3dd3cc52bab699d5504e1
BLAKE2b-256 972a5023c8a454f6b7bb076625165187f84567fdabc10720b22be67a84eacf04

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