Runtime Cloud Python SDK
One client for every Runtime Cloud product, sync and async. Python 3.10 or later, standard library only.
pip install withruntime-cloud
The client uses RUNTIME_API_KEY when it is set, and otherwise the connection
this machine saved when npx @withruntime/cloud login connected it (one browser
approval, no key to copy). On a server, set RUNTIME_API_KEY from your secret
manager (create a key at https://withruntime.com/account/keys). Never put a key
in source code, a URL or a command-line argument.
from runtime_cloud import Sandbox
with Sandbox.create() as sbx:
result = sbx.exec("python3 -c 'print(6 * 7)'")
print(result.exit_code, result.stdout)
Sandbox.create() needs no arguments and returns once the sandbox is running;
leaving the with block stops it. AsyncRuntime is the same client for
asyncio, method for method:
import asyncio
from runtime_cloud import AsyncRuntime
async def main():
async with AsyncRuntime() as runtime:
async with await runtime.sandboxes.create() as sbx:
print((await sbx.exec("uname -a")).stdout)
asyncio.run(main())
A sandbox has exec, exec_stream, spawn, terminal, files (read, write,
list, glob, stat, move, remove, upload and download directories), pause,
wake, extend, fork and snapshot, and the interpreter, network,
previews and desktop products. The client has sandboxes, images,
volumes, snapshots, feedback and support. Every write carries an
idempotency key, so retries never do anything twice; errors are typed and carry
code, hint and request_id.
Release files for withruntime-cloud 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| withruntime_cloud-0.2.0.tar.gz | 50.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| withruntime_cloud-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 104.3 kB
Release files / withruntime_cloud-0.2.0.tar.gz
| Download URL | withruntime_cloud-0.2.0.tar.gz |
|---|---|
| Size | 50.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ac75f95e22f6a22555b67e7ce23ce5f50cc00f86d188db954006dc7281679fa5
|
|
BLAKE2b-256 checksum How to use checksums |
876ab58164f343184498a4ac8e5c09d73bf7e93296a40eaeb81b034ee68cf95f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.11
|
Release files / withruntime_cloud-0.2.0-py3-none-any.whl
| Download URL | withruntime_cloud-0.2.0-py3-none-any.whl |
|---|---|
| Size | 53.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d2914e04d3328bed1568f77d9c6990a9665313ddffd22268c01c8d8bc891661c
|
|
BLAKE2b-256 checksum How to use checksums |
1fd5649aec54c61c7f638ac592838afc5614e8dd0292820744765706e2d540f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.11
|