# Platon-Daytona SDK for Python
[](https://badge.fury.io/py/platon-daytona)
[](https://pypi.org/project/platon-daytona/)
[](https://opensource.org/licenses/Apache-2.0)
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.
**This is a fork of the original Daytona SDK, enhanced and maintained by Platon.AI.**
## Key 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
- **Async Support**: Full async/await support for modern Python applications
## Installation
You can install the package using pip:
```bash
pip install platon-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
))
```
## 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})
```
### Async Support
```python
import asyncio
from daytona import AsyncDaytona
async def main():
daytona = AsyncDaytona()
sandbox = await daytona.create()
response = await sandbox.process.code_run('print("Async Hello!")')
print(response.result)
await daytona.delete(sandbox)
asyncio.run(main())
```
## What's Different in This Fork
This fork includes several enhancements over the original Daytona SDK:
- Enhanced error handling and debugging capabilities
- Additional utility functions for common operations
- Improved documentation and examples
- Better type hints and IDE support
- Regular updates and maintenance by Platon.AI team
## API Compatibility
This package maintains 100% API compatibility with the original Daytona SDK. You can use it as a drop-in replacement:
```python
# Import works exactly the same as original
from daytona import Daytona, DaytonaConfig, AsyncDaytona
```
## Requirements
- Python 3.8 or higher
- Valid Daytona API credentials
## Contributing
We welcome contributions! This project is based on the original Daytona SDK and follows the same contribution guidelines.
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests if applicable
5. Submit a pull request
## License
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
## Support
- **Issues**: [GitHub Issues](https://github.com/galaxyeye/daytona/issues)
- **Documentation**: [Project Documentation](https://galaxyeye.github.io/daytona)
- **Email**: ivincent.zhang@gmail.com
## Acknowledgments
This project is based on the excellent work by Daytona Platforms Inc. We thank the original team for creating such a powerful SDK.
---
**Note**: This is an independent fork maintained by Platon.AI. For the original Daytona SDK, please visit the official Daytona repository.
Raw data
{
"_id": null,
"home_page": "https://github.com/galaxyeye/daytona",
"name": "platon-daytona",
"maintainer": "Platon.AI",
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": "ivincent.zhang@gmail.com",
"keywords": "daytona, sdk, platon, sandbox, development, ai",
"author": "Daytona Platforms Inc.",
"author_email": "support@daytona.io",
"download_url": "https://files.pythonhosted.org/packages/04/dd/61ae28840592222c3520ace4a59352a81086baf4f75b2e1b7c279d3fde44/platon_daytona-0.1.5.tar.gz",
"platform": null,
"description": "# Platon-Daytona SDK for Python\n\n[](https://badge.fury.io/py/platon-daytona)\n[](https://pypi.org/project/platon-daytona/)\n[](https://opensource.org/licenses/Apache-2.0)\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**This is a fork of the original Daytona SDK, enhanced and maintained by Platon.AI.**\n\n## Key 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- **Async Support**: Full async/await support for modern Python applications\n\n## Installation\n\nYou can install the package using pip:\n\n```bash\npip install platon-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))\n```\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### Async Support\n\n```python\nimport asyncio\nfrom daytona import AsyncDaytona\n\nasync def main():\n daytona = AsyncDaytona()\n sandbox = await daytona.create()\n \n response = await sandbox.process.code_run('print(\"Async Hello!\")')\n print(response.result)\n \n await daytona.delete(sandbox)\n\nasyncio.run(main())\n```\n\n## What's Different in This Fork\n\nThis fork includes several enhancements over the original Daytona SDK:\n\n- Enhanced error handling and debugging capabilities\n- Additional utility functions for common operations\n- Improved documentation and examples\n- Better type hints and IDE support\n- Regular updates and maintenance by Platon.AI team\n\n## API Compatibility\n\nThis package maintains 100% API compatibility with the original Daytona SDK. You can use it as a drop-in replacement:\n\n```python\n# Import works exactly the same as original\nfrom daytona import Daytona, DaytonaConfig, AsyncDaytona\n```\n\n## Requirements\n\n- Python 3.8 or higher\n- Valid Daytona API credentials\n\n## Contributing\n\nWe welcome contributions! This project is based on the original Daytona SDK and follows the same contribution guidelines.\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests if applicable\n5. Submit a pull request\n\n## License\n\nThis project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.\n\n## Support\n\n- **Issues**: [GitHub Issues](https://github.com/galaxyeye/daytona/issues)\n- **Documentation**: [Project Documentation](https://galaxyeye.github.io/daytona)\n- **Email**: ivincent.zhang@gmail.com\n\n## Acknowledgments\n\nThis project is based on the excellent work by Daytona Platforms Inc. We thank the original team for creating such a powerful SDK.\n\n---\n\n**Note**: This is an independent fork maintained by Platon.AI. For the original Daytona SDK, please visit the official Daytona repository.\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Python SDK for Daytona, forked by platon.ai with enhanced features",
"version": "0.1.5",
"project_urls": {
"Bug Tracker": "https://github.com/galaxyeye/daytona/issues",
"Changelog": "https://github.com/galaxyeye/daytona/blob/main/CHANGELOG.md",
"Documentation": "https://galaxyeye.github.io/daytona",
"Homepage": "https://github.com/galaxyeye/daytona",
"Repository": "https://github.com/galaxyeye/daytona",
"Source Code": "https://github.com/galaxyeye/daytona"
},
"split_keywords": [
"daytona",
" sdk",
" platon",
" sandbox",
" development",
" ai"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a8545ebbb1cd964ad2d6e3d4894f1064e50d14809db8305f0f4d798f15e37d53",
"md5": "38bfcb19f2bc0869a10ae4d2f9f31d73",
"sha256": "d11be632793e28d04a1823dd6d6f33a95d4bacbd5ec9f0b256acc4d34c5db56f"
},
"downloads": -1,
"filename": "platon_daytona-0.1.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "38bfcb19f2bc0869a10ae4d2f9f31d73",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 106895,
"upload_time": "2025-07-14T02:39:13",
"upload_time_iso_8601": "2025-07-14T02:39:13.392942Z",
"url": "https://files.pythonhosted.org/packages/a8/54/5ebbb1cd964ad2d6e3d4894f1064e50d14809db8305f0f4d798f15e37d53/platon_daytona-0.1.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "04dd61ae28840592222c3520ace4a59352a81086baf4f75b2e1b7c279d3fde44",
"md5": "1f1d2856396520eced721f3988532abf",
"sha256": "1a7cc8991fa4813c4e64894392870ae0cc4d09fcddd4cda8bfe615bc70c80b9e"
},
"downloads": -1,
"filename": "platon_daytona-0.1.5.tar.gz",
"has_sig": false,
"md5_digest": "1f1d2856396520eced721f3988532abf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 84936,
"upload_time": "2025-07-14T02:39:14",
"upload_time_iso_8601": "2025-07-14T02:39:14.841402Z",
"url": "https://files.pythonhosted.org/packages/04/dd/61ae28840592222c3520ace4a59352a81086baf4f75b2e1b7c279d3fde44/platon_daytona-0.1.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-14 02:39:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "galaxyeye",
"github_project": "daytona",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "platon-daytona"
}