Python SDK
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.
Metadata
Release files for codesphere 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| codesphere-1.0.0.tar.gz | 124.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| codesphere-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 165.4 kB
Release files / codesphere-1.0.0.tar.gz
| Download URL | codesphere-1.0.0.tar.gz |
|---|---|
| Size | 124.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3ad575766f879979d037002ec6762d455bd4c675444e8364d1a4eefd1889161a
|
|
BLAKE2b-256 checksum How to use checksums |
cb0a02d189e0b236348acb71441f716bb68a26047f7a32d0744fbc18a49c6d9e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|
Release files / codesphere-1.0.0-py3-none-any.whl
| Download URL | codesphere-1.0.0-py3-none-any.whl |
|---|---|
| Size | 40.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
86124f91452fe89ea24c0c0980252c4a86ba7264c81042a46396d7ea9eba24e8
|
|
BLAKE2b-256 checksum How to use checksums |
0872b99b182964687db31d977982fb53ba06872de55323298bc34735d473263c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|