Python SDK for the Sail sandbox platform
Project description
sail-sdk
Python SDK for the Sail sandbox platform.
Install
pip install sail-sdk
uv add sail-sdk
Sailbox exec
import sail
app = sail.App.find(name="example-app", mint_if_missing=True)
sb = sail.Sailbox.create(
image=sail.Image.debian_amd64,
app=app,
name="sandbox-1",
)
result = sb.exec("echo hi", timeout=5).wait()
print(result.stdout)
print(result.stderr)
print(result.returncode)
# Detached background launch. wait() waits for the launcher shell, not for the
# long-lived background process to exit.
sb.exec("python3 -m http.server 3000", background=True).wait()
# Omitting timeout means Sail will not terminate the exec automatically.
sb.exec("sleep 600").wait()
Sailbox networking
import sail
app = sail.App.find(name="example-app", mint_if_missing=True)
sb = sail.Sailbox.create(
image=sail.Image.debian_amd64,
app=app,
name="sandbox-net",
timeout=300,
ingress_ports=[3000],
)
listener = sb.listener(3000)
print(listener.url)
req = sb.request(
"POST",
"https://example.com/api",
json={"hello": "world"},
idempotency_key="example-1",
)
print(req.id, req.status)
completed = req.wait()
print(completed.status)
print(completed.response.status_code)
print(completed.response.text)
Explicit base images:
amd64_image = sail.Image.debian_amd64
amd_image = sail.Image.debian_amd
arm64_image = sail.Image.debian_arm64
arm_image = sail.Image.debian_arm
Examples
examples/sailbox_smoke.py: start a sailbox from the amd64 Debian image.examples/sailbox_custom_image.py: build a custom image withapt_install,pip_install,run_commands, andenv, then launch a sailbox from it.
Publishing
Build a distributable package locally from the repo root:
just python-sdk-build
Publish from a developer machine with a PyPI token:
export UV_PUBLISH_TOKEN=pypi-...
just python-sdk-publish
The repository also includes a GitHub Actions release workflow at .github/workflows/python-sdk-publish.yml.
It publishes when you push a tag like python-sdk-v0.1.0, after verifying that the tag version matches sail.__version__.
Recommended setup:
- Create the
sail-sdkproject on PyPI. - Configure PyPI Trusted Publishing for this GitHub repository and the
python-sdk-publish.ymlworkflow. - Bump
sdk/python/src/sail/__about__.py. - Push a matching tag:
git tag python-sdk-v0.1.0 && git push origin python-sdk-v0.1.0
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 sail_sdk-0.1.1.tar.gz.
File metadata
- Download URL: sail_sdk-0.1.1.tar.gz
- Upload date:
- Size: 49.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d058964038b47cec3d5117989238796cd3ea6ab84e6123a28db372aecfcc4fe
|
|
| MD5 |
7ccfc1d0f05d750ceb03aac61116d4e5
|
|
| BLAKE2b-256 |
c3d800fba99fd3afe820ecb56c814540ad1eec7d2de2da831dd8a942ab9c6564
|
File details
Details for the file sail_sdk-0.1.1-py3-none-any.whl.
File metadata
- Download URL: sail_sdk-0.1.1-py3-none-any.whl
- Upload date:
- Size: 27.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45b12c4ed9770351807f910d0deb9e4ae71b34340915afa4254fa8d6f1209bdd
|
|
| MD5 |
b8e4b85e441d5b5d278472a083629f66
|
|
| BLAKE2b-256 |
739f36eac023869393fe2a07179ca3152c811ac4a0dae62a3e031c42969b4844
|