Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

PPIO Sandbox SDK for Python

Python SDK for PPIO Sandbox environments, providing code execution, desktop automation, and cloud computing capabilities, which is compatible with e2b.

Please read the documentation for more information.

Installation

pip install ppio-sandbox

Features

  • 🚀 Code Interpreter: Execute Python, JavaScript, and other languages in isolated environments
  • 🖥️ Desktop Automation: Control desktop applications and GUI interactions
  • ☁️ Cloud Computing: Scalable sandbox environments for various computing tasks
  • 📊 Data Visualization: Built-in charting and visualization capabilities
  • 🔧 File System Operations: Complete file system management and monitoring

Quick Start

Authentication

You can get the PPIO API key by refer to this documentation.

Core

The basic package provides a way to interact with the sandbox environment.

from ppio_sandbox.core import Sandbox
import os

# Using the official template `base` by default
sandbox = Sandbox.create(
    template="base",
    api_key=os.getenv("PPIO_API_KEY", "")
)

# File operations
sandbox.files.write('/tmp/test.txt', 'Hello, World!')
content = sandbox.files.read('/tmp/test.txt')

# Command execution
result = sandbox.commands.run('ls -la /tmp')
print(result.stdout)

sandbox.kill()

Code Interpreter

The Code Interpreter sandbox provides a Jupyter-like environment for executing code using the official code-interpreter-v1 template.

from ppio_sandbox.code_interpreter import Sandbox
import os

sandbox = Sandbox.create(
    api_key=os.getenv("PPIO_API_KEY", "")
)

# Execute Python code
result = sandbox.run_code('print("Hello, World!")')
print(result.logs)

sandbox.kill()

Desktop

The Desktop sandbox allows you to control desktop environments programmatically using the official desktop template.

from ppio_sandbox.desktop import Sandbox
import os

desktop = Sandbox.create(
    api_key=os.getenv("PPIO_API_KEY", "")
)

# Take a screenshot
screenshot = desktop.screenshot()

# Automate mouse and keyboard
desktop.left_click(100, 200)
desktop.press('Return')
desktop.write('Hello, World!')

desktop.kill()

Development

Install

poetry install --with dev --extras "all" 

Test

make test
make test-core
make test-code-interpreter
make test-desktop

Template environment scope

set_envs({...}) adds build-only variables. Use set_envs({...}, runtime=True) when the resolved values must also be available in the sandbox. Dockerfile ENV is persisted at runtime; Dockerfile ARG remains build-only. Declaration order is preserved, and values in one declaration group read the preceding environment. Image ENV values are literals; inherited WORKDIR applies before caller steps.

template = Template().from_image("python:3.12-slim")
template.set_envs({"BUILD_MODE": "release"})
template.set_envs({"PATH": "/app/bin:$PATH", "APP_MODE": "worker"}, runtime=True)

Mutable image tags are refreshed for each serialization/build. Only successful digest-pinned registry reads are cached; failed reads can be retried on the same builder. Explicit caller commands and settings take precedence over image defaults.

Sandbox security options

The legacy secure and public traffic options are deprecated. Existing call sites remain accepted, but the SDK warns and never sends these controls to the API. Security policy is controlled by the backend. Python emits a DeprecationWarning; JavaScript emits a console warning. Remove the deprecated options to silence it.

Network information returned by the backend still includes the public traffic state. Use the sandbox's traffic access token in the Sandbox-Traffic-Access-Token header when accessing a custom port. Instance connect/reset updates this token when one is returned; reset does not issue an extra connect request to obtain a missing token.

Metadata

Release files for ppio-sandbox 2.1.4a5

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

Source distribution (sdist)

Source distribution for ppio-sandbox 2.1.4a5
File Size Uploaded Provenance Actions
ppio_sandbox-2.1.4a5.tar.gz 567.3 kB Without provenance Details for ppio_sandbox-2.1.4a5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ppio-sandbox 2.1.4a5
File Interpreter ABI Platform Actions
ppio_sandbox-2.1.4a5-py3-none-any.whl Python 3 none any Details for ppio_sandbox-2.1.4a5-py3-none-any.whl

Total release size: 1.2 MB

Release files / ppio_sandbox-2.1.4a5.tar.gz

Download URL ppio_sandbox-2.1.4a5.tar.gz
Size 567.3 kB
Tags Source
SHA-256 checksum
How to use checksums
94cb3cecfc16e7f2677704af20d4cd2bf4fcb5c41b5117fe2555848443ab4cf4
BLAKE2b-256 checksum
How to use checksums
ba670dd8a13faf5dfc48fde8898e687ac9b7d8d6b354ef5cfba37aa8d9a3e0aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.2 CPython/3.12.16 Linux/7.0.0-1019-azure

Release files / ppio_sandbox-2.1.4a5-py3-none-any.whl

Download URL ppio_sandbox-2.1.4a5-py3-none-any.whl
Size 679.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
93831789ce675376d59b3cb0619c994b03c130f860fe59670e36c6be08eb67f5
BLAKE2b-256 checksum
How to use checksums
dbcbe188767b4e0c01289e68bc2b6577f0bce878d3da9e9ddd20b4c33186dd91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.2 CPython/3.12.16 Linux/7.0.0-1019-azure

Security for ppio-sandbox 2.1.4a5

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.

Release history Release notifications | RSS feed

This release
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