Skip to main content

Use Codesphere within python scripts.

Project description

Codesphere

Python SDK

PyPI Python License

The official Python client for the Codesphere API.


Installation

uv add codesphere

Configuration

Create a .env file in your project root:

Variable Description Default
CS_TOKEN API token (required)
CS_BASE_URL API base URL https://codesphere.com/api

Quick Start

import asyncio
from codesphere import CodesphereSDK

async def main():
    async with CodesphereSDK() as sdk:
        teams = await sdk.teams.list()
        for team in teams:
            print(f"{team.name} (ID: {team.id})")

asyncio.run(main())

Usage

Teams

teams = await sdk.teams.list()
team = await sdk.teams.get(team_id=123)
await team.delete()

Workspaces

workspaces = await sdk.workspaces.list(team_id=123)
workspace = await sdk.workspaces.get(workspace_id=456)

result = await workspace.execute_command("ls -la")
print(result.output)

await workspace.env_vars.set([{"name": "API_KEY", "value": "secret"}])
env_vars = await workspace.env_vars.get()

Domains

team = await sdk.teams.get(team_id=123)
domains = await team.domains.list()
domain = await team.domains.create(name="api.example.com")

Metadata

datacenters = await sdk.metadata.list_datacenters()
plans = await sdk.metadata.list_plans()
images = await sdk.metadata.list_images()

Development

git clone https://github.com/Datata1/codesphere-python.git
cd codesphere-python
uv sync --all-extras
uv run pytest

License

MIT – see LICENSE for details.

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

codesphere-1.0.0.tar.gz (124.8 kB view details)

Uploaded Source

Built Distribution

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

codesphere-1.0.0-py3-none-any.whl (40.6 kB view details)

Uploaded Python 3

File details

Details for the file codesphere-1.0.0.tar.gz.

File metadata

  • Download URL: codesphere-1.0.0.tar.gz
  • Upload date:
  • Size: 124.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for codesphere-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3ad575766f879979d037002ec6762d455bd4c675444e8364d1a4eefd1889161a
MD5 b009cd19e2919d6307eddb85cb8dac7e
BLAKE2b-256 cb0a02d189e0b236348acb71441f716bb68a26047f7a32d0744fbc18a49c6d9e

See more details on using hashes here.

File details

Details for the file codesphere-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: codesphere-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 40.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for codesphere-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 86124f91452fe89ea24c0c0980252c4a86ba7264c81042a46396d7ea9eba24e8
MD5 fa2406c50f4db4f62b0f77cb19e93cb9
BLAKE2b-256 0872b99b182964687db31d977982fb53ba06872de55323298bc34735d473263c

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