Python SDK for Watasu sandboxes
Project description
Watasu SDKs
Python, TypeScript, and Rust SDKs for Watasu sandboxes.
Sandbox.create and Sandbox.connect are single provider operations: the
control-plane API waits for the runtime lifecycle internally and returns success
only with a usable data-plane session. SDKs do not poll sandbox readiness.
Python
from watasu import Sandbox
sbx = Sandbox.create()
sbx.files.write("/home/user/a.py", "print(2+2)")
result = sbx.commands.run("python /home/user/a.py")
print(result.stdout)
sbx.kill()
TypeScript
import { Sandbox } from '@watasu/sdk'
const sbx = await Sandbox.create()
await sbx.files.write('/home/user/a.js', 'console.log(2 + 2)')
const result = await sbx.commands.run('node /home/user/a.js')
console.log(result.stdout)
await sbx.kill()
Rust
use watasu::{CreateOptions, Sandbox};
#[tokio::main]
async fn main() -> watasu::Result<()> {
let sbx = Sandbox::create(CreateOptions::default()).await?;
sbx.files.write("/home/user/a.py", "print(2 + 2)").await?;
let result = sbx.commands.run("python /home/user/a.py").await?;
println!("{}", result.stdout);
sbx.kill().await?;
Ok(())
}
The Rust crate is async and uses Tokio. It defaults to rustls-tls; use
default-features = false with features = ["native-tls"] or
features = ["native-tls-vendored"] if your deployment needs native OpenSSL
TLS instead.
Set WATASU_API_KEY before use. The Sandbox, commands, and files surfaces
are implemented over Watasu's control-plane REST API and data-plane
REST/WebSocket runtime. Unsupported surfaces raise clear not-implemented errors.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file watasu-0.1.1.tar.gz.
File metadata
- Download URL: watasu-0.1.1.tar.gz
- Upload date:
- Size: 56.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f4ec69e53b239421b3be1953c0bff749d594088b5cee27ad632ac63e04f8025
|
|
| MD5 |
77968d44c7569f95028b0ebfb9f2319a
|
|
| BLAKE2b-256 |
0d95e0fef6b747e9408050e7d9a7eea852cf4af0783d36786949e34665acc3e2
|
File details
Details for the file watasu-0.1.1-py3-none-any.whl.
File metadata
- Download URL: watasu-0.1.1-py3-none-any.whl
- Upload date:
- Size: 29.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
205b5d037dcb4bd9b17d53dc1312cd8f1cd0bb287f650245226f7b0b9900b3d9
|
|
| MD5 |
867aead2fade642db16be46c92f4ca7d
|
|
| BLAKE2b-256 |
f156595beba2c2ed02815021f7f3650bcd54cb20034be2a678d526a71ce3b8e7
|