Metadata-Version: 2.4
Name: daytona_sdk
Version: 0.19.0a5
Summary: Python SDK for Daytona
Author-email: "Daytona Platforms Inc." <support@daytona.io>
License: AGPL-3.0
Keywords: daytona,sdk
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Requires-Dist: daytona_api_client<1.0.0,>=0.19.1
Requires-Dist: environs<10.0.0,>=9.5.0
Requires-Dist: marshmallow<4.0.0,>=3.19.0
Requires-Dist: pydantic<3.0.0,>=2.4.2
Requires-Dist: python-dateutil<3.0.0,>=2.8.2
Requires-Dist: urllib3<3.0.0,>=2.0.7
Requires-Dist: Deprecated<2.0.0,>=1.2.18
Requires-Dist: httpx<0.29.0,>=0.28.0
Requires-Dist: requests_toolbelt<1.1.0,>=1.0.0
Requires-Dist: boto3<1.38.0,>=1.37.0
Requires-Dist: toml<0.11.0,>=0.10.0
Provides-Extra: dev
Requires-Dist: pydoc-markdown>=4.8.2; extra == "dev"
Requires-Dist: build>=1.0.3; extra == "dev"
Requires-Dist: wheel>=0.41.2; extra == "dev"
Requires-Dist: setuptools>=68.0.0; extra == "dev"
Requires-Dist: twine>=4.0.2; extra == "dev"
Requires-Dist: nbqa<2.0.0,>=1.9.1; extra == "dev"
Requires-Dist: black[jupyter]<24.0.0,>=23.1.0; extra == "dev"
Requires-Dist: pylint<4.0.0,>=3.3.4; extra == "dev"
Requires-Dist: isort<6.0.0,>=5.10.0; extra == "dev"
Requires-Dist: matplotlib<3.11.0,>=3.10.0; extra == "dev"

# Daytona SDK for Python

A Python SDK for interacting with the Daytona API, providing a simple interface for Daytona Sandbox management, Git operations, file system operations, and language server protocol support.

## Installation

You can install the package using pip:

```bash
pip install daytona-sdk
```

## Quick Start

Here's a simple example of using the SDK:

```python
from daytona_sdk import Daytona

# Initialize using environment variables
daytona = Daytona()

# Create a sandbox
sandbox = daytona.create()

# Run code in the sandbox
response = sandbox.process.code_run('print("Hello World!")')
print(response.result)

# Clean up when done
daytona.delete(sandbox)
```

## Configuration

The SDK can be configured using environment variables or by passing a configuration object:

```python
from daytona_sdk import Daytona, DaytonaConfig

# Initialize with configuration
config = DaytonaConfig(
    api_key="your-api-key",
    api_url="your-api-url",
    target="us"
)
daytona = Daytona(config)
```

Or using environment variables:

- `DAYTONA_API_KEY`: Your Daytona API key
- `DAYTONA_API_URL`: The Daytona API URL
- `DAYTONA_TARGET`: Your target environment

You can also customize sandbox creation:

```python
sandbox = daytona.create(CreateSandboxParams(
    language="python",
    env_vars={"PYTHON_ENV": "development"},
    auto_stop_interval=60  # Auto-stop after 1 hour of inactivity
))
```

## Features

- **Sandbox Management**: Create, manage and remove sandboxes
- **Git Operations**: Clone repositories, manage branches, and more
- **File System Operations**: Upload, download, search and manipulate files
- **Language Server Protocol**: Interact with language servers for code intelligence
- **Process Management**: Execute code and commands in sandboxes

## Examples

### Execute Commands

```python
# Execute a shell command
response = sandbox.process.exec('echo "Hello, World!"')
print(response.result)

# Run Python code
response = sandbox.process.code_run('''
x = 10
y = 20
print(f"Sum: {x + y}")
''')
print(response.result)
```

### File Operations

```python
# Upload a file
sandbox.fs.upload_file(b'Hello, World!', 'path/to/file.txt')

# Download a file
content = sandbox.fs.download_file('path/to/file.txt')

# Search for files
matches = sandbox.fs.find_files(root_dir, 'search_pattern')
```

### Git Operations

```python
# Clone a repository
sandbox.git.clone('https://github.com/example/repo', 'path/to/clone')

# List branches
branches = sandbox.git.branches('path/to/repo')

# Add files
sandbox.git.add('path/to/repo', ['file1.txt', 'file2.txt'])
```

### Language Server Protocol

```python
# Create and start a language server
lsp = sandbox.create_lsp_server('typescript', 'path/to/project')
lsp.start()

# Notify the lsp for the file
lsp.did_open('path/to/file.ts')

# Get document symbols
symbols = lsp.document_symbols('path/to/file.ts')

# Get completions
completions = lsp.completions('path/to/file.ts', {"line": 10, "character": 15})
```

## Contributing

Daytona is Open Source under the [GNU AFFERO GENERAL PUBLIC LICENSE](LICENSE), and is the [copyright of its contributors](NOTICE). If you would like to contribute to the software, read the Developer Certificate of Origin Version 1.1 (https://developercertificate.org/). Afterwards, navigate to the [contributing guide](CONTRIBUTING.md) to get started.
