Skip to content

Commit 5271b18

Browse files
authored
refactor: Change README file (#37)
* refactor: Change README file
1 parent 4447e94 commit 5271b18

1 file changed

Lines changed: 86 additions & 24 deletions

File tree

README.md

Lines changed: 86 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,111 @@
11
<p align="center">
2-
<img src="https://ai.codesphere.com/img/codesphere-logo.png" alt="Codesphere API SDK Banner" width="100">
2+
<picture>
3+
<source media="(prefers-color-scheme: dark)" srcset="https://codesphere.com/img/codesphere-light.svg">
4+
<source media="(prefers-color-scheme: light)" srcset="https://codesphere.com/img/codesphere-dark.svg">
5+
<img src="https://codesphere.com/img/codesphere-light.svg" alt="Codesphere" width="300">
6+
</picture>
37
</p>
48

5-
<h1 align="center">Codesphere Python SDK</h1>
9+
<h1 align="center">Python SDK</h1>
610

711
<p align="center">
8-
<strong>The official Python client for the Codesphere Public API.</strong>
9-
<br />
10-
<br />
1112
<a href="https://pypi.org/project/codesphere/">
12-
<img alt="PyPI Version" src="https://img.shields.io/pypi/v/codesphere.svg?style=flat-square&logo=pypi&logoColor=white">
13-
</a>
14-
<a href="https://github.com/Datata1/codesphere-python/actions/workflows/publish.yml">
15-
<img alt="Build Status" src="https://img.shields.io/github/actions/workflow/status/datata1/codesphere-python-sdk/publish.yml?branch=main&style=flat-square&logo=githubactions&logoColor=white">
13+
<img alt="PyPI" src="https://img.shields.io/pypi/v/codesphere.svg?style=flat-square">
1614
</a>
1715
<a href="https://pypi.org/project/codesphere/">
18-
<img alt="Python Versions" src="https://img.shields.io/pypi/pyversions/codesphere.svg?style=flat-square&logo=python&logoColor=white">
19-
</a>
20-
<a href="https://github.com/Datata1/codesphere-python/tree/main/examples">
21-
<img alt="Documentation" src="https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square">
22-
</a>
23-
<a href="https://github.com/Datata1/codesphere-python/releases/latest">
24-
<img alt="Latest Release" src="https://img.shields.io/github/v/release/Datata1/codesphere-python-sdk?style=flat-square&logo=github&logoColor=white">
16+
<img alt="Python" src="https://img.shields.io/pypi/pyversions/codesphere.svg?style=flat-square">
2517
</a>
2618
<a href="https://github.com/Datata1/codesphere-python/blob/main/LICENSE">
2719
<img alt="License" src="https://img.shields.io/pypi/l/codesphere.svg?style=flat-square">
2820
</a>
2921
</p>
3022

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

33-
## Overview
3427

35-
The Codesphere Python SDK provides a convenient wrapper for the [Codesphere Public API](https://codesphere.com/api/swagger-ui/?ref=codesphere.ghost.io&anonymousId=K9iszev), allowing you to interact with all API resources from your Python applications.
3628

37-
## Installation
29+
---
3830

39-
You can install the SDK directly from PyPI using `pip` (or your favorite package manager like `uv`).
31+
## Installation
4032

4133
```bash
42-
pip install codesphere
34+
uv add codesphere
35+
```
36+
37+
## Configuration
38+
39+
Create a `.env` file in your project root:
40+
41+
| Variable | Description | Default |
42+
|----------|-------------|---------|
43+
| `CS_TOKEN` | API token (required) ||
44+
| `CS_BASE_URL` | API base URL | `https://codesphere.com/api` |
45+
46+
## Quick Start
47+
48+
```python
49+
import asyncio
50+
from codesphere import CodesphereSDK
51+
52+
async def main():
53+
async with CodesphereSDK() as sdk:
54+
teams = await sdk.teams.list()
55+
for team in teams:
56+
print(f"{team.name} (ID: {team.id})")
57+
58+
asyncio.run(main())
4359
```
4460

45-
or
61+
## Usage
62+
63+
### Teams
64+
65+
```python
66+
teams = await sdk.teams.list()
67+
team = await sdk.teams.get(team_id=123)
68+
await team.delete()
69+
```
70+
71+
### Workspaces
72+
73+
```python
74+
workspaces = await sdk.workspaces.list(team_id=123)
75+
workspace = await sdk.workspaces.get(workspace_id=456)
76+
77+
result = await workspace.execute_command("ls -la")
78+
print(result.output)
79+
80+
await workspace.env_vars.set([{"name": "API_KEY", "value": "secret"}])
81+
env_vars = await workspace.env_vars.get()
82+
```
83+
84+
### Domains
85+
86+
```python
87+
team = await sdk.teams.get(team_id=123)
88+
domains = await team.domains.list()
89+
domain = await team.domains.create(name="api.example.com")
90+
```
91+
92+
### Metadata
93+
94+
```python
95+
datacenters = await sdk.metadata.list_datacenters()
96+
plans = await sdk.metadata.list_plans()
97+
images = await sdk.metadata.list_images()
98+
```
99+
100+
## Development
46101

47102
```bash
48-
uv add codesphere
103+
git clone https://github.com/Datata1/codesphere-python.git
104+
cd codesphere-python
105+
uv sync --all-extras
106+
uv run pytest
49107
```
108+
109+
## License
110+
111+
MIT – see [LICENSE](LICENSE) for details.

0 commit comments

Comments
 (0)