{ } 📦 Code Sandboxes
Code Sandboxes (code_sandboxes) is a Python package for running code in isolated sandbox variants through a unified API.
Canonical variant names:
jupyterdockerevalmontykagglecolabmodaldatalayer
Documentation
The full documentation is the single source of truth:
- Docs home: https://code-sandboxes.datalayer.tech
- Sandboxes and variant setup: https://code-sandboxes.datalayer.tech/sandboxes
- Installation: https://code-sandboxes.datalayer.tech/installation
- CLI usage: https://code-sandboxes.datalayer.tech/cli
- API reference: https://code-sandboxes.datalayer.tech/api-reference
- Examples: https://code-sandboxes.datalayer.tech/examples
- Comparison: https://code-sandboxes.datalayer.tech/comparison
Published site:
Install
pip install code-sandboxes
For backend-specific extras and credentials, see https://code-sandboxes.datalayer.tech/installation and https://code-sandboxes.datalayer.tech/sandboxes.
Quick Examples
Python: launch a jupyter sandbox
from code_sandboxes import Sandbox
# Option 1: manage a local Jupyter server automatically
with Sandbox.create(variant="jupyter") as sandbox:
print(sandbox.run_code("1 + 1").text) # 2
# Option 2: connect to an existing Jupyter server
with Sandbox.create(
variant="jupyter",
server_url="http://localhost:8888",
token="MY_TOKEN",
) as sandbox:
sandbox.run_code("x = 40")
print(sandbox.run_code("x + 2").text) # 42
CLI REPL: kaggle variant
Kaggle REPL supports both interactive runtime mode and credential-based batch mode.
Required credentials for batch mode:
~/.kaggle/kaggle.json, orKAGGLE_API_KEY
# Install Kaggle support
pip install code-sandboxes[kaggle]
# Optional: env-based credentials (if not using ~/.kaggle/kaggle.json)
export KAGGLE_API_KEY="<your-kaggle-api-key>"
# Launch the REPL
sandbox repl --variant kaggle
For full setup and parameters for all variants, see:
- https://code-sandboxes.datalayer.tech/sandboxes
- https://code-sandboxes.datalayer.tech/cli
- https://code-sandboxes.datalayer.tech/installation
License
BSD 3-Clause License
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file code_sandboxes-0.17.0-py3-none-any.whl.
File metadata
- Download URL: code_sandboxes-0.17.0-py3-none-any.whl
- Upload date:
- Size: 66.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
181f364510594fe9db988d10e1834f6e7a97dc20a1294e9dd9173b8f71fc9dd3
|
|
| MD5 |
431272d444b2dc6e5fa99d5c5ce9d8f0
|
|
| BLAKE2b-256 |
30bcb9992b7008db14e5396137f440c07ecae122429f06991f33045ca59cf094
|