Skip to main content

Runtime Python SDK and CLI

Project description

runtime-sdk

Python SDK and CLI for Runtime.

Install

uv tool install runtime-sdk

To upgrade an existing install:

uv tool upgrade runtime-sdk

Configure

The CLI talks to http://127.0.0.1:8080 by default. Override it with:

export RUNTIME_BASE_URL=https://api.runruntime.dev

Or pass --base-url per command.

Usage

# Auth
runtime login you@example.com
runtime verify 123456
runtime whoami
runtime logout
runtime login --api-key rt_live_...

# Computers
runtime create                       # in a real TTY, creates then drops you into the console
runtime create myapp --command "python3 app.py" --cwd /home/ubuntu --port 3000
runtime enter <name-or-id>         # accepts slug/name like test, or the computer id
runtime list
runtime info <id>
runtime start <id>
runtime run <id> "echo hello"
runtime run <id> "apt install -y nodejs" --uid 0
runtime publish <id> 3000
runtime delete <id>

Python

from runtime_sdk import RuntimeClient

client = RuntimeClient(base_url="https://api.runruntime.dev", api_key="rt_live_...")

# Create a computer
computer = client.create_computer()
print(computer["public_url"])  # https://goldbird.runruntime.dev

# Or create one with a durable startup command.
# That startup config is replayed after cold restore / auto-wake.
app = client.create_computer(
    slug="myapp",
    command="python3 app.py",
    cwd="/home/ubuntu",
    port=3000,
)

# Run a command
result = client.run_command(computer["id"], "echo hello")
print(result["stdout"])

# Wake a cold computer explicitly
client.start_computer(app["id"])

# Pin the public URL to a local app port
client.publish_port(computer["id"], 3000)

# List, info, delete
computers = client.list_computers()
info = client.get_computer(computer["id"])
client.delete_computer(computer["id"])

Development

For fast local backend iteration:

make local-backend

For deploying and testing against the Hetzner production server:

make sync SERVER_IP=x.x.x.x SSH_USER=root
make smoke

Use make deploy instead of make sync when migrations, env files, Caddy, or systemd units changed.

Cold restore and public auto-wake replay the saved startup command only for computers created with --command + --port (or the SDK command/port arguments). If you start an app later via a one-off runtime run, the filesystem is restored after going cold, but that ad-hoc process is not.

Run the SDK unit tests through the backend project environment:

uv run python -m unittest scripts.tests.test_runtime_sdk

Release

Preview the next release without changing files:

./scripts/release_runtime_sdk.sh --dry-run

Publish a patch release:

./scripts/release_runtime_sdk.sh --publish

Publish a different version bump:

./scripts/release_runtime_sdk.sh --bump minor --publish

The script loads backend/.env automatically, so UV_PUBLISH_TOKEN can live there.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

runtime_sdk-0.4.1.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

runtime_sdk-0.4.1-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file runtime_sdk-0.4.1.tar.gz.

File metadata

  • Download URL: runtime_sdk-0.4.1.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.4

File hashes

Hashes for runtime_sdk-0.4.1.tar.gz
Algorithm Hash digest
SHA256 2d2dd89639aff6648fa595606e88c72fc8b53fbc93e11dd20252a1f656527fa0
MD5 257931c2117073f82217cbef7d3342f9
BLAKE2b-256 e6f15f42105de4b4dc3f8300f17bc101994e18bb1286d4e1798d1e0c34967c14

See more details on using hashes here.

File details

Details for the file runtime_sdk-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for runtime_sdk-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ca84a8987193efff2c1c0d7e1a314ebb8204bc61383e701c7309c30d0ff7279f
MD5 86f50d6a17d1499a111d6fcf5520d2a2
BLAKE2b-256 80f376b3f7cdb54f35d45e75e30221f617247ad8c0618cbd73a32865260b51b8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page