Skip to main content

readie-client

Run a Python function on a remote checkpoint-restore worker by decorating it.

from readie import remote
import asyncio


@remote
def add(a, b):
    return a + b

print(add(1, 2))  # blocking

async def add_async(a, b):
    return await add.aio(a, b)

print(asyncio.run(add_async(1, 2)))  # from an event loop

The decorated function is serialised with cloudpickle and executed by a Python interpreter inside a gVisor sandbox, so it must be picklable and its imports must exist in the worker's image.

Resource budgets

Declare how much memory a function needs on the decorator. Each budget takes a byte count or a size string ("512Mi", "4Gi"); an unset budget falls back to the cluster default.

@remote(gpu=True, memory="2Gi", max_memory="8Gi")
def train(rows): ...

memory is the container's initial limit and max_memory the ceiling the worker may auto-expand to when the function needs more; gpu_memory / max_gpu_memory are the same for GPU device memory. gpu=True sends the call to a GPU worker (a gpu_memory budget implies it too). The client also statically extracts the function's imports and forwards them so the router can pick a checkpoint that already imported them - this is automatic and needs no configuration.

Packages

Declare PyPI requirements a function needs beyond what the checkpoint's rootfs already carries. The executor installs them with uv before every call:

@remote(packages=["numpy==1.26.0", "requests"])
def fetch(url): ...

Entries are requirement strings (a bare name or a full spec like "numpy==1.26.0"), normalized and deduped by distribution name at decoration time - "Requests" and "requests" collapse to one entry. Installation is unconditional: it runs on every call, even when the package looks already present, since each call restores a fresh, isolated container with nothing to check that claim against.

make install   # sync the virtualenv from the lockfile
make test      # unit + in-process gRPC integration tests
make lint type # ruff + mypy --strict

Configuration options:

import readie

readie.configure(router_uri="localhost:50051", timeout=120.0, chunk_size=64*1024, stream_logs=True, tls=False)

The following are configurable only from the environment:

READIE_AUTH_TOKEN bearer token for a router that requires one; unset sends none
READIE_TLS_CA connect over TLS; a CA path verifies the nginx server, else system roots. TLS is required for HTTPS router URIs

When a remote function raises

You get the real traceback, from the process that raised it:

try:
    train()
except readie.RemoteExecutionError as error:
    print(error.remote_type)  # "ValueError"
    print(error.remote_traceback)  # the frames inside the sandbox
    print(error.worker_id, error.container_id)

The exception object is not reconstructed. Unpickling it would need its class importable here, and for a library that exists only in the worker image the resulting ImportError would replace the real error with a confusing one.

EmptyResultError means something else entirely: the worker returned nothing at all, so the executor died before it could report an outcome. A function that returns None returns a value and does not land there.

Sessions

By default every call is independent and gets a fresh container. To reuse a warm container - and the Python state it holds - open a session:

with readie.default_client().session() as s:
    load_data.bind(s)()  # cold start
    train.bind(s)()  # resumes the same interpreter

Calls inside one session are serialised by the router: a session maps to one container running one interpreter behind one socket, so they cannot safely run at once. Unrelated sessions stay fully parallel.

Metadata

Release files for readie 0.2.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for readie 0.2.6
File Size Uploaded Provenance
readie-0.2.6.tar.gz 60.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for readie 0.2.6
File Interpreter ABI Platform
readie-0.2.6-py3-none-any.whl Python 3 none any Details

Total release size: 97.7 kB

Release files / readie-0.2.6.tar.gz

Download URL readie-0.2.6.tar.gz
Size 60.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7fe4673cf892dabfce39fff6db2790a9a5af7e3b9953a064465f03a51d947f2d
BLAKE2b-256 checksum
How to use checksums
d75dbc4622027f75724eafe9a330a1e734fd2f4448070a15e9d03f462e8e3c04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"20.04","id":"focal","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / readie-0.2.6-py3-none-any.whl

Download URL readie-0.2.6-py3-none-any.whl
Size 37.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e131bf572d2ba4d5c97ec06104bf336d95fb688b32472da2e46cfbbf2d294eda
BLAKE2b-256 checksum
How to use checksums
7ff1347de66e4eb6ddcbab531b1b960062e571f1048fec2106afdd5c819ecaa5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"20.04","id":"focal","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for readie 0.2.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page