daytona


Namedaytona JSON
Version 0.24.1 PyPI version JSON
download
home_pageNone
SummaryPython SDK for Daytona
upload_time2025-07-16 08:34:00
maintainerNone
docs_urlNone
authorDaytona Platforms Inc.
requires_python<4.0,>=3.9
licenseApache-2.0
keywords daytona sdk
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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
```

## Quick Start

Here's a simple example of using the SDK:

```python
from daytona 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 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(CreateSandboxFromSnapshotParams(
    language="python",
    env_vars={"PYTHON_ENV": "development"},
    auto_stop_interval=60,  # Auto-stop after 1 hour of inactivity
    auto_archive_interval=60,  # Auto-archive after a Sandbox has been stopped for 1 hour
    auto_delete_interval=120 # Auto-delete after a Sandbox has been stopped for 2 hours
))
```

## 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 [Apache License 2.0](/libs/sdk-python/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.

Code in [\_sync](/libs/sdk-python/src/daytona/_sync/) directory shouldn't be edited directly. It should be generated from the corresponding async code in the [\_async](/libs/sdk-python/src/daytona/_async/) directory using the [sync_generator.py](/libs/sdk-python/scripts/sync_generator.py) script.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "daytona",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "daytona, sdk",
    "author": "Daytona Platforms Inc.",
    "author_email": "support@daytona.io",
    "download_url": "https://files.pythonhosted.org/packages/94/59/ff3ece86d3e8b62621b4e993e4eafe40e72322a821f84812350e78b22ab7/daytona-0.24.1.tar.gz",
    "platform": null,
    "description": "# Daytona SDK for Python\n\nA 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.\n\n## Installation\n\nYou can install the package using pip:\n\n```bash\npip install daytona\n```\n\n## Quick Start\n\nHere's a simple example of using the SDK:\n\n```python\nfrom daytona import Daytona\n\n# Initialize using environment variables\ndaytona = Daytona()\n\n# Create a sandbox\nsandbox = daytona.create()\n\n# Run code in the sandbox\nresponse = sandbox.process.code_run('print(\"Hello World!\")')\nprint(response.result)\n\n# Clean up when done\ndaytona.delete(sandbox)\n```\n\n## Configuration\n\nThe SDK can be configured using environment variables or by passing a configuration object:\n\n```python\nfrom daytona import Daytona, DaytonaConfig\n\n# Initialize with configuration\nconfig = DaytonaConfig(\n    api_key=\"your-api-key\",\n    api_url=\"your-api-url\",\n    target=\"us\"\n)\ndaytona = Daytona(config)\n```\n\nOr using environment variables:\n\n- `DAYTONA_API_KEY`: Your Daytona API key\n- `DAYTONA_API_URL`: The Daytona API URL\n- `DAYTONA_TARGET`: Your target environment\n\nYou can also customize sandbox creation:\n\n```python\nsandbox = daytona.create(CreateSandboxFromSnapshotParams(\n    language=\"python\",\n    env_vars={\"PYTHON_ENV\": \"development\"},\n    auto_stop_interval=60,  # Auto-stop after 1 hour of inactivity\n    auto_archive_interval=60,  # Auto-archive after a Sandbox has been stopped for 1 hour\n    auto_delete_interval=120 # Auto-delete after a Sandbox has been stopped for 2 hours\n))\n```\n\n## Features\n\n- **Sandbox Management**: Create, manage and remove sandboxes\n- **Git Operations**: Clone repositories, manage branches, and more\n- **File System Operations**: Upload, download, search and manipulate files\n- **Language Server Protocol**: Interact with language servers for code intelligence\n- **Process Management**: Execute code and commands in sandboxes\n\n## Examples\n\n### Execute Commands\n\n```python\n# Execute a shell command\nresponse = sandbox.process.exec('echo \"Hello, World!\"')\nprint(response.result)\n\n# Run Python code\nresponse = sandbox.process.code_run('''\nx = 10\ny = 20\nprint(f\"Sum: {x + y}\")\n''')\nprint(response.result)\n```\n\n### File Operations\n\n```python\n# Upload a file\nsandbox.fs.upload_file(b'Hello, World!', 'path/to/file.txt')\n\n# Download a file\ncontent = sandbox.fs.download_file('path/to/file.txt')\n\n# Search for files\nmatches = sandbox.fs.find_files(root_dir, 'search_pattern')\n```\n\n### Git Operations\n\n```python\n# Clone a repository\nsandbox.git.clone('https://github.com/example/repo', 'path/to/clone')\n\n# List branches\nbranches = sandbox.git.branches('path/to/repo')\n\n# Add files\nsandbox.git.add('path/to/repo', ['file1.txt', 'file2.txt'])\n```\n\n### Language Server Protocol\n\n```python\n# Create and start a language server\nlsp = sandbox.create_lsp_server('typescript', 'path/to/project')\nlsp.start()\n\n# Notify the lsp for the file\nlsp.did_open('path/to/file.ts')\n\n# Get document symbols\nsymbols = lsp.document_symbols('path/to/file.ts')\n\n# Get completions\ncompletions = lsp.completions('path/to/file.ts', {\"line\": 10, \"character\": 15})\n```\n\n## Contributing\n\nDaytona is Open Source under the [Apache License 2.0](/libs/sdk-python/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.\n\nCode in [\\_sync](/libs/sdk-python/src/daytona/_sync/) directory shouldn't be edited directly. It should be generated from the corresponding async code in the [\\_async](/libs/sdk-python/src/daytona/_async/) directory using the [sync_generator.py](/libs/sdk-python/scripts/sync_generator.py) script.\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Python SDK for Daytona",
    "version": "0.24.1",
    "project_urls": null,
    "split_keywords": [
        "daytona",
        " sdk"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8869ee7a5546576a5ce10fe4546e0474f106cccf26f32948015c17d3bb7e859e",
                "md5": "7d9c2751443f3b50881c3cde2ba0a194",
                "sha256": "2a8e891573f10b670c25c96032467a2d818fee8aa9f2df96d2cc84e74c02b161"
            },
            "downloads": -1,
            "filename": "daytona-0.24.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7d9c2751443f3b50881c3cde2ba0a194",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 114506,
            "upload_time": "2025-07-16T08:33:58",
            "upload_time_iso_8601": "2025-07-16T08:33:58.736753Z",
            "url": "https://files.pythonhosted.org/packages/88/69/ee7a5546576a5ce10fe4546e0474f106cccf26f32948015c17d3bb7e859e/daytona-0.24.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9459ff3ece86d3e8b62621b4e993e4eafe40e72322a821f84812350e78b22ab7",
                "md5": "d1da041793667bb4bf544d4bddd2757a",
                "sha256": "cc967caa1fdb2ff64f6d4cb36a9d0e158ee9e3773f55095103794846315baec1"
            },
            "downloads": -1,
            "filename": "daytona-0.24.1.tar.gz",
            "has_sig": false,
            "md5_digest": "d1da041793667bb4bf544d4bddd2757a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 91623,
            "upload_time": "2025-07-16T08:34:00",
            "upload_time_iso_8601": "2025-07-16T08:34:00.287212Z",
            "url": "https://files.pythonhosted.org/packages/94/59/ff3ece86d3e8b62621b4e993e4eafe40e72322a821f84812350e78b22ab7/daytona-0.24.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-16 08:34:00",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "daytona"
}
        
Elapsed time: 1.18698s