Name | daytona-sdk JSON |
Version |
0.9.0
JSON |
| download |
home_page | None |
Summary | Python SDK for Daytona |
upload_time | 2025-02-03 15:26:32 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.7 |
license | Apache 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 Daytona Server API, providing a simple interface for Daytona Workspace management, Git operations, file system operations, and language server protocol support.
## Prerequisites
Before using the Daytona SDK, you need to have a running Daytona server instance and proper configuration.
### Server Installation
For detailed instructions on installing and setting up the Daytona server, please refer to the official installation guide at:
[https://github.com/daytonaio/daytona](https://github.com/daytonaio/daytona)
### Configuration
To use the SDK, you'll need two essential pieces of information:
1. **Server Address**:
- Run `daytona server config` to get your server's configuration
- Look for the `API URL` value in the output
- For testing and development, you can use the FRP address provided
- For production environments, it's recommended to use a static address
2. **API Key**:
- Generate a new API key by running:
```bash
daytona api-key generate
```
- Save this key securely as it will be needed to authenticate with the server
## 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 the Daytona client
daytona = Daytona()
# Create the workspace instance
workspace = daytona.create()
# Run the code securely inside the workspace
response = workspace.process.code_run('print("Hello World!")')
print(response.result)
```
## Features
- **Workspace Management**: Create, manage and remove workspaces
- **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 workspaces
## Configuration
The SDK can be configured using environment variables or by passing a configuration object:
```python
from daytona_sdk import Daytona, DaytonaConfig
config = DaytonaConfig(
api_key='your-api-key',
server_url='https://your-daytona-server',
target='your-target'
)
daytona = Daytona(config)
```
Or using environment variables:
- `DAYTONA_API_KEY`: Your Daytona API key
- `DAYTONA_SERVER_URL`: The Daytona server URL
- `DAYTONA_TARGET`: Your target environment
## Examples
### Execute command
```python
response = workspace.process.code_run('print("Sum of 3 and 4 is " + str(3 + 4))')
if response.code != 0:
print(f"Error: {response.code} {response.result}")
else:
print(response.result)
```
### File Operations
```python
# Upload a file
workspace.fs.upload_file('/path/to/file.txt', b'Hello, World!')
# Download a file
content = workspace.fs.download_file('/path/to/file.txt')
# Search for files
matches = workspace.fs.find_files(root_dir, 'search_pattern')
```
### Git Operations
```python
# Clone a repository
workspace.git.clone('https://github.com/example/repo', '/path/to/clone')
# List branches
branches = workspace.git.branches('/path/to/repo')
# Add files
workspace.git.add('/path/to/repo', ['file1.txt', 'file2.txt'])
```
### Language Server Protocol
```python
# Create and start a language server
lsp = workspace.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
Contributions are welcome! Please feel free to submit a Pull Request.
## License
This project is licensed under the Apache License, Version 2.0 - see below for details:
```
Copyright 2024 Daytona
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
For the full license text, please see the [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).
Raw data
{
"_id": null,
"home_page": null,
"name": "daytona-sdk",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "daytona, sdk",
"author": null,
"author_email": "Vedran Jukic <vedran.jukic@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/45/0c/ba30c55546f390eaf83c050e992a277702bc6f8af68cb204b0f29bc9f654/daytona_sdk-0.9.0.tar.gz",
"platform": null,
"description": "# Daytona SDK for Python\n\nA Python SDK for interacting with Daytona Server API, providing a simple interface for Daytona Workspace management, Git operations, file system operations, and language server protocol support.\n\n## Prerequisites\n\nBefore using the Daytona SDK, you need to have a running Daytona server instance and proper configuration.\n\n### Server Installation\n\nFor detailed instructions on installing and setting up the Daytona server, please refer to the official installation guide at:\n[https://github.com/daytonaio/daytona](https://github.com/daytonaio/daytona)\n\n### Configuration\n\nTo use the SDK, you'll need two essential pieces of information:\n\n1. **Server Address**:\n\n - Run `daytona server config` to get your server's configuration\n - Look for the `API URL` value in the output\n - For testing and development, you can use the FRP address provided\n - For production environments, it's recommended to use a static address\n\n2. **API Key**:\n - Generate a new API key by running:\n ```bash\n daytona api-key generate\n ```\n - Save this key securely as it will be needed to authenticate with the server\n\n## Installation\n\nYou can install the package using pip:\n\n```bash\npip install daytona-sdk\n```\n\n## Quick Start\n\nHere's a simple example of using the SDK:\n\n```python\nfrom daytona_sdk import Daytona\n\n# Initialize the Daytona client\ndaytona = Daytona()\n\n# Create the workspace instance\nworkspace = daytona.create()\n\n# Run the code securely inside the workspace\nresponse = workspace.process.code_run('print(\"Hello World!\")')\nprint(response.result)\n```\n\n## Features\n\n- **Workspace Management**: Create, manage and remove workspaces\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 workspaces\n\n## Configuration\n\nThe SDK can be configured using environment variables or by passing a configuration object:\n\n```python\nfrom daytona_sdk import Daytona, DaytonaConfig\n\nconfig = DaytonaConfig(\n api_key='your-api-key',\n server_url='https://your-daytona-server',\n target='your-target'\n)\n\ndaytona = Daytona(config)\n```\n\nOr using environment variables:\n\n- `DAYTONA_API_KEY`: Your Daytona API key\n- `DAYTONA_SERVER_URL`: The Daytona server URL\n- `DAYTONA_TARGET`: Your target environment\n\n## Examples\n\n### Execute command\n\n```python\nresponse = workspace.process.code_run('print(\"Sum of 3 and 4 is \" + str(3 + 4))')\nif response.code != 0:\n print(f\"Error: {response.code} {response.result}\")\nelse:\n print(response.result)\n```\n\n### File Operations\n\n```python\n# Upload a file\nworkspace.fs.upload_file('/path/to/file.txt', b'Hello, World!')\n\n# Download a file\ncontent = workspace.fs.download_file('/path/to/file.txt')\n\n# Search for files\nmatches = workspace.fs.find_files(root_dir, 'search_pattern')\n```\n\n### Git Operations\n\n```python\n# Clone a repository\nworkspace.git.clone('https://github.com/example/repo', '/path/to/clone')\n\n# List branches\nbranches = workspace.git.branches('/path/to/repo')\n\n# Add files\nworkspace.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 = workspace.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\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the Apache License, Version 2.0 - see below for details:\n\n```\nCopyright 2024 Daytona\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n\nFor the full license text, please see the [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).\n",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "Python SDK for Daytona",
"version": "0.9.0",
"project_urls": null,
"split_keywords": [
"daytona",
" sdk"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "396b818c598d43766705093aaf7b638e268bcb4184c99c08fa7dc8ab5ec322c7",
"md5": "72b7c23770105ea93cb2b7e3ac24839f",
"sha256": "9d1fe377b944e7306064a271f7d931bfae5337590b31063e1aac82264fa098f3"
},
"downloads": -1,
"filename": "daytona_sdk-0.9.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "72b7c23770105ea93cb2b7e3ac24839f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 16843,
"upload_time": "2025-02-03T15:26:30",
"upload_time_iso_8601": "2025-02-03T15:26:30.165820Z",
"url": "https://files.pythonhosted.org/packages/39/6b/818c598d43766705093aaf7b638e268bcb4184c99c08fa7dc8ab5ec322c7/daytona_sdk-0.9.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "450cba30c55546f390eaf83c050e992a277702bc6f8af68cb204b0f29bc9f654",
"md5": "8a81c6a65bd97853433996b689827a78",
"sha256": "a7d1b9f882be1c1a98b0c3a7c50f46c3651bda235c45cb8cad9ddaa6cacbf9a2"
},
"downloads": -1,
"filename": "daytona_sdk-0.9.0.tar.gz",
"has_sig": false,
"md5_digest": "8a81c6a65bd97853433996b689827a78",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 15411,
"upload_time": "2025-02-03T15:26:32",
"upload_time_iso_8601": "2025-02-03T15:26:32.209204Z",
"url": "https://files.pythonhosted.org/packages/45/0c/ba30c55546f390eaf83c050e992a277702bc6f8af68cb204b0f29bc9f654/daytona_sdk-0.9.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-03 15:26:32",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "daytona-sdk"
}