Skip to main content

Type-safe remote Python function execution framework with multiple backend support

Project description

Remote Box

Type-safe remote Python function execution framework with multiple backend support.

Installation

uv add remote-box

Quick Start

Execute Python functions on remote machines with type safety:

from pathlib import Path
from pydantic import BaseModel
from remote import remote, E2B

class Input(BaseModel):
    name: str

class Output(BaseModel):
    greeting: str

@remote(
    local_project_root=Path(__file__).parent,
    backend=E2B(
        template_prefix="my-project"
    )
)
async def greet(input: Input) -> Output:
    # This code runs on a remote E2B sandbox!
    return Output(greeting=f"Hello {input.name}!")

# Usage
result = await greet(Input(name="World"))
print(result.greeting)  # "Hello World!"

Features

  • Type-safe: Inputs/outputs validated using Pydantic models
  • Multiple backends:
    • E2B — Remote secure sandboxes
    • Daytona — Remote sandboxes with snapshot-based images
    • Subprocess — Local execution for development/testing
  • Async-first: Built on asyncio for high performance
  • Automatic serialization: No manual JSON handling needed
  • Pre-checks at import time: Backend validation and snapshot/template creation happens once when the decorator is applied, not on every call

Backends

E2B (Production)

Execute code on remote secure sandboxes via E2B.

from remote import remote, E2B

@remote(
    local_project_root=Path(__file__).parent,
    backend=E2B(
        template_prefix="my-project",   # template name becomes "my-project-v{version}"
        e2b_api_key="...",              # or set E2B_API_KEY env var
        cpu_count=2,
        memory_mb=2048,
    )
)
async def my_func(input: Input) -> Output: ...

The template is built automatically from your Dockerfile the first time it's needed (keyed by {template_prefix}-v{version} where version comes from pyproject.toml).

Daytona (Production)

Execute code on remote sandboxes via Daytona. Snapshots are created automatically from your Dockerfile.

from remote import remote, Daytona

@remote(
    local_project_root=Path(__file__).parent,
    backend=Daytona(
        snapshot_name="my-project",     # snapshot name becomes "my-project-v{version}"
        daytona_api_key="...",          # or set DAYTONA_API_KEY env var
        cpu_count=2,
        memory_gb=2,
        disk_gb=5,
    )
)
async def my_func(input: Input) -> Output: ...

Subprocess (Development)

Execute code in a local subprocess via uv run. Ideal for development and testing — no API keys or Docker required.

from remote import remote, Subprocess, BackendShell

@remote(
    local_project_root=Path(__file__).parent,
    backend=Subprocess(shell=BackendShell.ZSH)  # ZSH default on macOS; use BASH4 on Linux
)
async def my_func(input: Input) -> Output: ...

Configuration Reference

remote decorator

Parameter Type Default Description
local_project_root Path required Root directory used to resolve imports and locate Dockerfile/pyproject.toml
backend AnyBackendConfig Subprocess(shell=BackendShell.ZSH) Backend to execute on
timeout_millis int 300000 Max execution time in ms (default 5 minutes)

E2B config

Parameter Default Description
template_prefix required Prefix for E2B template name ({prefix}-v{version})
e2b_api_key None API key (falls back to E2B_API_KEY env var)
template_version None Override version; defaults to pyproject.toml version
dockerfile_path None Path to Dockerfile; defaults to Dockerfile in project root
cpu_count 1 CPUs to allocate
memory_mb 1024 Memory in MB to allocate

Daytona config

Parameter Default Description
snapshot_name required Prefix for Daytona snapshot name ({name}-v{version})
daytona_api_key None API key (falls back to DAYTONA_API_KEY env var)
snapshot_version None Override version; defaults to pyproject.toml version
dockerfile_path None Path to Dockerfile; defaults to Dockerfile in project root
cpu_count 1 CPUs to allocate
memory_gb 1 Memory in GB to allocate
disk_gb 3 Disk in GB to allocate

Subprocess config

Parameter Default Description
shell required BackendShell.ZSH or BackendShell.BASH4

License

MIT

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

remote_box-0.2.1.tar.gz (99.3 kB view details)

Uploaded Source

Built Distribution

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

remote_box-0.2.1-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file remote_box-0.2.1.tar.gz.

File metadata

  • Download URL: remote_box-0.2.1.tar.gz
  • Upload date:
  • Size: 99.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for remote_box-0.2.1.tar.gz
Algorithm Hash digest
SHA256 8218807b3cc59e4c27dbc097a0a56479991bdab1724af49481958a46b691a5fb
MD5 fc87c36e8b5b930ba807abf216bcfa40
BLAKE2b-256 1d4cf3167afbc7dca1192b4e6b560c5a317c2426d5ffe5c36a03ce58410f334c

See more details on using hashes here.

Provenance

The following attestation bundles were made for remote_box-0.2.1.tar.gz:

Publisher: release.yml on JasonSteving99/remote-box

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file remote_box-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: remote_box-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for remote_box-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b7a65542950729e17763653c3de737727daba0cdd7f73e2d1fe5b20c13f776bd
MD5 862481b2165b5f064d0f0cb19dd9d9bf
BLAKE2b-256 bcb3cb19aeffadcde6722b7b4dfe1edf31c64d2505935ff8d3a68c685dca9faf

See more details on using hashes here.

Provenance

The following attestation bundles were made for remote_box-0.2.1-py3-none-any.whl:

Publisher: release.yml on JasonSteving99/remote-box

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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