Metadata-Version: 2.3
Name: dev2cloud
Version: 0.3.1
Summary: Dev2Cloud client library
Author: Pasha Kononov
Author-email: Pasha Kononov <hello@dev2.cloud>
License: The MIT License (MIT)
         
         Copyright (c) 2011-2025 The Bootstrap Authors
         
         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.
Requires-Dist: httpx>=0.28.1
Requires-Dist: pydantic>=2.12.5
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# dev2cloud

Python client for the [Dev2Cloud](https://dev2.cloud) API — spin up ephemeral Postgres and Redis sandboxes in seconds.

## Installation

```bash
pip install dev2cloud
```

## Quick Start

Sign up at [dev2.cloud](https://dev2.cloud) and grab your API key from the [dashboard](https://dev2.cloud/dashboard).

### Create a Postgres sandbox

```python
from dev2cloud import Dev2Cloud, SandboxType

client = Dev2Cloud(api_key="your-api-key")

sandbox = client.create_sandbox(SandboxType.POSTGRES)

print(sandbox.url)
# postgresql://user:pass@connect.dev2.cloud:5432/postgres
```

### Create a Redis sandbox

```python
sandbox = client.create_sandbox(SandboxType.REDIS)

print(sandbox.url)
# redis://user:pass@connect.dev2.cloud:6379/0
```

### Manage sandboxes

```python
# List all active sandboxes
sandboxes = client.list_sandboxes()

# Get a sandbox by ID
sandbox = client.get_sandbox("sandbox-id")

# Delete a sandbox
client.delete_sandbox("sandbox-id")

# Delete all sandboxes
deleted_ids = client.delete_all()
```

### Async support

```python
from dev2cloud.asyncio import Dev2Cloud
from dev2cloud import SandboxType

client = Dev2Cloud(api_key="d2c_...")

sandbox = await client.create_sandbox(SandboxType.POSTGRES)
print(sandbox.url)
```

### Configuration

The API key can be provided directly or through the `D2C_API_KEY` environment variable:

```bash
export D2C_API_KEY="d2c_..."
```

```python
from dev2cloud import Dev2Cloud

client = Dev2Cloud()  # reads from D2C_API_KEY
```

## References

- [Homepage](https://dev2.cloud)
- [Dashboard](https://dev2.cloud/dashboard)
- [API Reference](https://api.dev2.cloud)
- [Usage Example](https://github.com/d2c-app/d2c-snippet)
- [X](https://x.com/dev2cloudmedia)

## License

MIT
