Skip to main content

PillDrops Python SDK

The Python client for PillDrops, a self-hosted engine that runs untrusted code in isolated microVMs. Create a sandbox, run commands and code in it, move files, start a server and get its preview URL, pause and resume it.

pip install pilldrops

Point it at your server

export PILLDROPS_API_URL=http://localhost:8080          # your PillDrops server
export PILLDROPS_API_KEY=$(cat /var/lib/sandboxd/bootstrap.key)

Settings resolve from explicit arguments, then PILLDROPS_API_URL / PILLDROPS_API_KEY (E2B_*, SANDFORGE_* and SANDBOX_* are read as fallbacks, so code written for the E2B SDK runs unchanged), then ~/.sandforge/config.json. There is no built-in server: set one.

Use it

from pilldrops import Sandbox

with Sandbox.create(template="python-3.11") as sb:          # destroyed on exit
    print(sb.run("python3 -c 'print(6*7)'").stdout)          # 42
    sb.files.write("app/main.py", "print('hello')")           # relative to the sandbox home
    print(sb.run("python3 app/main.py").stdout)              # hello
    sb.upload("./project", "/project")                       # a whole directory
    sb.pause()
    sb.resume()                                              # same memory, same processes

# A server, reachable at a preview URL
app = Sandbox.create(template="python-3.11", start="python3 -m http.server 8080", ports=[8080])
print(app.url)
app.kill()
Sandbox.create(template, *, image, start, ports, env, vcpu, mem_mb, storage_mb, timeout) a new sandbox
Sandbox.connect(id) · Sandbox.list() an existing one · all of them
sb.run(cmd, cwd, timeout, env) · sb.run_code(code, lang) ExecResult with stdout, stderr, exit_code, .ok, .check()
sb.files.write/read/list · sb.upload · sb.download files and directories
sb.url · sb.host(port) preview URLs
sb.pause() · sb.resume() · sb.set_timeout(s) · sb.kill() lifecycle
sb.logs() · sb.metrics() observability
build_image(context_dir, tag) build a custom image from a Dockerfile; launch it with Sandbox.create(image=…)

import sandforge and import yoursandbox still work: they ship in this package as aliases of its earlier names.

Tests

python3 -m pytest tests            # unit tests; the integration test skips without a server

License

MIT.

Metadata

Release files for pilldrops 1.1.1

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

Source distribution (sdist)

Source distribution for pilldrops 1.1.1
File Size Uploaded Provenance Actions
pilldrops-1.1.1.tar.gz 13.4 kB Without provenance Details for pilldrops-1.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 25.7 kB

Release files / pilldrops-1.1.1.tar.gz

Download URL pilldrops-1.1.1.tar.gz
Size 13.4 kB
Tags Source
SHA-256 checksum
How to use checksums
bea0487ec27e7f3330ebfd840c0ac013d37980f0268414dc9f1c6caf69806f62
BLAKE2b-256 checksum
How to use checksums
53d138023ac02efbd45f83d855c80867f04942b4befef4dfaf968c3b69720c42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release files / pilldrops-1.1.1-py3-none-any.whl

Download URL pilldrops-1.1.1-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f1b2e2f4492a567bbeae9aa4bc6e2f25d6118ec0c1f84aa96a52b7aeb6bd1071
BLAKE2b-256 checksum
How to use checksums
3a70ea2c67c9800757178490aae3594e9dc81212fc2bad826b6c099e13a9e8c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Security for pilldrops 1.1.1

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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