Metadata-Version: 2.4
Name: codesphere
Version: 1.0.0
Summary: Use Codesphere within python scripts.
Project-URL: Homepage, https://codesphere.com/
Project-URL: Repository, https://github.com/Datata1/codesphere-python
Project-URL: Bug Tracker, https://github.com/Datata1/codesphere-python/issues
Author-email: Datata1 <jan-david.wiederstein@codesphere.com>
License: MIT License
        
        Copyright (c) 2025 Jan-David Wiederstein
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.12.9
Requires-Dist: aiohttp-retry>=2.9.1
Requires-Dist: aiohttp>=3.12.13
Requires-Dist: httpx>=0.28.1
Requires-Dist: pydantic-settings>=2.11.0
Requires-Dist: pydantic>=2.11.7
Requires-Dist: python-dateutil>=2.9.0.post0
Requires-Dist: python-dotenv>=1.2.1
Requires-Dist: pyyaml>=6.0.2
Requires-Dist: typing-extensions>=4.14.0
Requires-Dist: urllib3>=2.4.0
Provides-Extra: dev
Requires-Dist: bandit>=1.7.0; extra == 'dev'
Requires-Dist: pre-commit>=4.2.0; extra == 'dev'
Requires-Dist: pytest-asyncio; extra == 'dev'
Requires-Dist: pytest-cov>=6.2.1; extra == 'dev'
Requires-Dist: pytest>=8.4.0; extra == 'dev'
Requires-Dist: ruff>=0.11.13; extra == 'dev'
Description-Content-Type: text/markdown

<p align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://codesphere.com/img/codesphere-light.svg">
    <source media="(prefers-color-scheme: light)" srcset="https://codesphere.com/img/codesphere-dark.svg">
    <img src="https://codesphere.com/img/codesphere-light.svg" alt="Codesphere" width="300">
  </picture>
</p>

<h1 align="center">Python SDK</h1>

<p align="center">
  <a href="https://pypi.org/project/codesphere/">
    <img alt="PyPI" src="https://img.shields.io/pypi/v/codesphere.svg?style=flat-square">
  </a>
  <a href="https://pypi.org/project/codesphere/">
    <img alt="Python" src="https://img.shields.io/pypi/pyversions/codesphere.svg?style=flat-square">
  </a>
  <a href="https://github.com/Datata1/codesphere-python/blob/main/LICENSE">
    <img alt="License" src="https://img.shields.io/pypi/l/codesphere.svg?style=flat-square">
  </a>
</p>

<p align="center">
  <strong>The official Python client for the <a href="https://codesphere.com/api/swagger-ui/">Codesphere API</a>.</strong>
</p>



---

## Installation

```bash
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

```python
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

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

### Workspaces

```python
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

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

### Metadata

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

## Development

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

## License

MIT – see [LICENSE](LICENSE) for details.
