-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
361 changed files
with
62,152 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM buildpack-deps:jammy-curl | ||
|
||
ARG TARGETARCH | ||
|
||
# common tools | ||
RUN apt update && export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt -y install --no-install-recommends apt-utils vim htop telnet socat expect-dev tini psmisc libgit2-dev | ||
|
||
# build tools | ||
RUN apt update && export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt -y install --no-install-recommends openjdk-11-jdk protobuf-compiler libprotobuf-dev | ||
|
||
CMD ["tail", "-f", "/dev/null"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"name": "Daytona SDK", | ||
"dockerFile": "Dockerfile", | ||
// Configure tool-specific properties. | ||
"customizations": { | ||
// Configure properties specific to VS Code. | ||
"vscode": { | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"dbaeumer.vscode-eslint", | ||
"esbenp.prettier-vscode", | ||
"astro-build.astro-vscode", | ||
"unifiedjs.vscode-mdx", | ||
"timonwong.shellcheck", | ||
"foxundermoon.shell-format", | ||
"cschlosser.doxdocgen" | ||
], | ||
"settings": { | ||
"editor.tabSize": 2 | ||
} | ||
} | ||
}, | ||
"features": { | ||
"ghcr.io/devcontainers/features/common-utils:2.5.2": { | ||
"installZsh": "true", | ||
"username": "daytona", | ||
"uid": "1000", | ||
"gid": "1000", | ||
"upgradePackages": "false" | ||
}, | ||
"ghcr.io/devcontainers/features/docker-in-docker:2.12.0": { | ||
"version": "24.0.7", | ||
"moby": false, | ||
"dockerDashComposeVersion": "v2" | ||
}, | ||
"ghcr.io/devcontainers/features/go:1.3.1": { | ||
"version": "1.19.3" | ||
}, | ||
"ghcr.io/devcontainers/features/node:1.6.1": { | ||
"version": "20.12.2" | ||
}, | ||
"ghcr.io/devcontainers/features/python:1": { | ||
"version": "3.10" | ||
} | ||
}, | ||
// Add this to automatically source the venv in new terminals | ||
"onCreateCommand": { | ||
"install-deps": "git config --global --add safe.directory ${containerWorkspaceFolder} && yarn", | ||
"copy-env": "cp -n .env .env.local" | ||
}, | ||
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. | ||
"remoteUser": "daytona", | ||
"remoteEnv": { | ||
"PYTHONPATH": "${containerWorkspaceFolder}/packages/python/src:${containerEnv:PYTHONPATH}" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[*] | ||
root = true | ||
end_of_line = lf | ||
|
||
indent_size = 2 | ||
indent_style = space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: '[release] Build language images' | ||
|
||
on: | ||
repository_dispatch: | ||
types: [update-version, new-release] | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Enter the version to release' | ||
required: true | ||
|
||
concurrency: | ||
# New commit on branch cancels running workflows of the same branch | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
VERSION: ${{ inputs.version || github.event.client_payload.release_tag }} | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
language: [typescript, python] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: hack/workspace-images/${{ matrix.language}} | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: daytonaio/sdk-${{ matrix.language }}:${{ env.VERSION }} | ||
build-args: | | ||
"DAYTONA_VERSION=${{ env.VERSION }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Dependencies | ||
node_modules | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
package-lock.json | ||
yarn.lock | ||
|
||
# Build outputs | ||
dist | ||
build | ||
.tmp | ||
|
||
# Environment variables | ||
.env | ||
.env.local | ||
.env.* | ||
|
||
# IDE and Editor files | ||
.idea/ | ||
.vscode/ | ||
*.swp | ||
*.swo | ||
.DS_Store | ||
|
||
# Testing | ||
coverage/ | ||
|
||
# Logs | ||
logs | ||
*.log | ||
|
||
# Cache directories | ||
.cache/ | ||
.next/ | ||
.nuxt/ | ||
.gatsby/ | ||
|
||
# Temp directory | ||
.tmp/ | ||
|
||
# Python virtual environment | ||
.venv/ | ||
|
||
# Python package metadata | ||
*.egg-info/ | ||
*.egg | ||
*.pyc | ||
__pycache__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"semi": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
Apache License | ||
Version 2.0, January 2004 | ||
http://www.apache.org/licenses/ | ||
|
||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | ||
|
||
1. Definitions. | ||
|
||
"License" shall mean the terms and conditions for use, reproduction, | ||
and distribution as defined by Sections 1 through 9 of this document. | ||
|
||
"Licensor" shall mean the copyright owner or entity authorized by | ||
the copyright owner that is granting the License. | ||
|
||
"Legal Entity" shall mean the union of the acting entity and all | ||
other entities that control, are controlled by, or are under common | ||
control with that entity. For the purposes of this definition, | ||
"control" means (i) the power, direct or indirect, to cause the | ||
direction or management of such entity, whether by contract or | ||
otherwise, or (ii) ownership of fifty percent (50%) or more of the | ||
outstanding shares, or (iii) beneficial ownership of such entity. | ||
|
||
"You" (or "Your") shall mean an individual or Legal Entity | ||
exercising permissions granted by this License. | ||
|
||
"Source" form shall mean the preferred form for making modifications, | ||
including but not limited to software source code, documentation | ||
source, and configuration files. | ||
|
||
"Object" form shall mean any form resulting from mechanical | ||
transformation or translation of a Source form, including but | ||
not limited to compiled object code, generated documentation, | ||
and conversions to other media types. | ||
|
||
"Work" shall mean the work of authorship, whether in Source or | ||
Object form, made available under the License, as indicated by a | ||
copyright notice that is included in or attached to the work | ||
(an example is provided in the Appendix below). | ||
|
||
"Derivative Works" shall mean any work, whether in Source or Object | ||
form, that is based on (or derived from) the Work and for which the | ||
editorial revisions, annotations, elaborations, or other modifications | ||
represent, as a whole, an original work of authorship |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Get version from root package.json | ||
VERSION := $(shell node -p "require('./package.json').version") | ||
|
||
.PHONY: sync-version build-all publish-all clean | ||
|
||
# Sync versions across packages | ||
sync-version: | ||
@echo "Syncing version $(VERSION) across packages..." | ||
@node -e "const p=require('./packages/typescript/package.json'); p.version='$(VERSION)'; require('fs').writeFileSync('./packages/typescript/package.json', JSON.stringify(p,null,2))" | ||
@echo "Updated TypeScript package version to $(VERSION)" | ||
@sed -i.bak 's/version = ".*"/version = "$(VERSION)"/' packages/python/pyproject.toml && rm packages/python/pyproject.toml.bak | ||
@echo "Updated Python package version to $(VERSION)" | ||
|
||
# Clean build artifacts | ||
clean: | ||
@echo "Cleaning build artifacts..." | ||
@rm -rf packages/typescript/dist | ||
@rm -rf packages/python/dist packages/python/build packages/python/*.egg-info | ||
|
||
# Build both packages | ||
build-all: clean sync-version | ||
@echo "Building all packages..." | ||
@cd packages/typescript && npm run build | ||
@cd packages/python && python -m build | ||
|
||
# Publish both packages | ||
publish-all: build-all | ||
@echo "Publishing all packages..." | ||
@cd packages/typescript && npm publish | ||
@cd packages/python && python -m twine upload dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
# Daytona SDK | ||
|
||
Official Python and TypeScript SDKs for interacting with Daytona, providing simple interfaces for managing development environments programmatically. This repository contains both SDK libraries, offering native integration options for Python and TypeScript/JavaScript applications. | ||
|
||
## SDK Examples | ||
|
||
### TypeScript/JavaScript | ||
|
||
Install the SDK: | ||
|
||
```bash | ||
npm install @daytona/sdk | ||
# or | ||
yarn add @daytona/sdk | ||
``` | ||
|
||
Basic usage: | ||
|
||
```typescript | ||
import { Daytona } from '@daytona/sdk' | ||
|
||
// Initialize the Daytona client | ||
const daytona = new Daytona() | ||
|
||
// Create the workspace instance | ||
const workspace = await daytona.create({ | ||
language: 'typescript', | ||
}) | ||
|
||
// Run the code securely inside the workspace | ||
const response = await workspace.process.code_run('console.log("Hello World!")') | ||
console.log(response.result) | ||
``` | ||
|
||
### Python | ||
|
||
Install the SDK: | ||
|
||
```bash | ||
pip install daytona-sdk | ||
``` | ||
|
||
Basic usage: | ||
|
||
```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) | ||
``` | ||
|
||
## About Daytona | ||
|
||
Daytona is a radically simple open source development environment manager that allows developers to spin up fully configured development environments with a single command. It eliminates the complexity of setting up development environments, whether they're local, remote, cloud-based, or on physical servers, supporting both x86 and ARM architectures. | ||
|
||
While Daytona offers a straightforward way to manage development environments, these SDKs bring that same power to your Python and TypeScript applications, enabling programmatic control over your development infrastructure. | ||
|
||
## Why Daytona SDK? | ||
|
||
These SDKs extend Daytona's capabilities by allowing you to: | ||
|
||
- Integrate Daytona's functionality into your existing Python and TypeScript applications | ||
- Automate development environment creation and management | ||
- Programmatically handle workspace configurations | ||
- Manage Git operations and repository connections | ||
- Control file system operations within workspaces | ||
- Interface with language server protocols | ||
- Build custom tooling and automation around your development environments | ||
- Create isolated environments for running AI-generated code safely | ||
- Set up data processing pipelines with configurable compute resources | ||
- Deploy and test machine learning models in isolated environments | ||
|
||
## AI and Data Processing Use Cases | ||
|
||
Daytona SDKs excel in scenarios involving AI and data processing, offering flexible deployment options across multiple infrastructure providers and technologies: | ||
|
||
- **AI Code Execution**: Create isolated environments to safely run and test AI-generated code on your choice of infrastructure: | ||
|
||
- Deploy identical environments across AWS, GCP, Azure, or any major cloud provider | ||
- Leverage Kubernetes clusters for scalability | ||
- Quickly create ephemeral environments for parallel code generation trajectories | ||
|
||
- **Data Processing Pipelines**: Configure and manage environments for data processing workflows: | ||
|
||
- Choose optimal infrastructure based on data locality | ||
- Enable distributed processing | ||
- Scale across multiple cloud regions | ||
- Support hybrid cloud deployments | ||
|
||
- **Resource Management**: Dynamically allocate compute resources based on workload requirements: | ||
|
||
- Provision resources across different cloud providers | ||
- Scale container resources on demand | ||
- Manage Kubernetes cluster resources | ||
- Support bare metal resource allocation | ||
|
||
- **Environment Isolation**: Ensure security when running untrusted code or processing sensitive data: | ||
- Configurable isolation level: Sysbox, LVMs, VMs | ||
- Provision dedicated VMs for enhanced isolation | ||
- Deploy in private cloud environments | ||
- Utilize network isolation features | ||
- Implement cloud-specific security controls | ||
|
||
## 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). |
Oops, something went wrong.