Skip to main content

bwrapwrap

A bubblewrap wrapper that sandboxes commands with sensible defaults. Network is blocked, the filesystem is read-only (except the current directory), and namespaces are unshared — all with a single command.

Prerequisites

sudo apt install bubblewrap

Optional, for --fork overlay mode:

sudo apt install fuse-overlayfs

Installation

pipx install .

Or for development:

pipx install -e .

Usage

bww [OPTIONS] <command> [args...]

Options

Flag Description
--net Allow network access (blocked by default)
--ptrace Allow ptrace (for strace/gdb)
--fork [NAME] Fork ~/.claude via fuse-overlayfs into ~/.bww/NAME/
--fork-cleanup Delete the fork directory on exit
--dry-run Print the bwrap command without running it
--help, -h Show help

Examples

# Run a script with no network
bww python3 script.py

# Allow network access
bww --net curl https://example.com

# Run claude with real ~/.claude bound read-write
bww --net claude

# Fork ~/.claude into a copy-on-write overlay
bww --fork --net claude

# Named fork (resumable)
bww --fork=experiment --net claude

# Inspect the generated bwrap command
bww --dry-run echo hello

What gets mounted

Mount Mode
/usr, /lib, /lib64, /bin, /sbin read-only
/etc/alternatives, /etc/fonts, /etc/ssl, /etc/ca-certificates read-only
/proc, /dev standard
/tmp tmpfs
Current working directory read-write
~/.cargo, ~/.rustup (if they exist) read-only
PATH directories read-only
~/.claude/projects/<cwd-session>/ (claude only) read-write
~/.claude/{.credentials.json,settings.json,CLAUDE.md} (claude only) read-only

Claude detection

When the command name contains "claude", bww binds only the project session directory for the current working directory (~/.claude/projects/<encoded-cwd>/) read-write. Shared config files (.credentials.json, settings.json, CLAUDE.md) are bound read-only. Other projects' session data is never exposed. Use --fork to isolate writes into a copy-on-write overlay instead.

Testing

pip install -e ".[test]"
pytest tests/ -v

To test against the original bash script:

SANDBOX_BIN=./sandbox.bash pytest tests/ -v

Metadata

Release files for bwrapwrap 0.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 bwrapwrap 0.1.1
File Size Uploaded
bwrapwrap-0.1.1.tar.gz 20.9 kB Details

Built distribution (wheel)

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

Total release size: 39.5 kB

Release files / bwrapwrap-0.1.1.tar.gz

Download URL bwrapwrap-0.1.1.tar.gz
Size 20.9 kB
Tags Source
SHA-256 checksum
How to use checksums
bc467e51ce41b1c1640471be3d30ba255c36fd062b51f20559d91bc3b5a1b2c2
BLAKE2b-256 checksum
How to use checksums
825cf315d5d7d6585e2ffb1692e4eef705e0d291c2b90d4f2cd7d70b2f8e18d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 21, 2026.

Transparency log

Release files / bwrapwrap-0.1.1-py3-none-any.whl

Download URL bwrapwrap-0.1.1-py3-none-any.whl
Size 18.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
05e029636153e311603dffc44bd3b5e737054280d4b9e0253d9e3d29cad993d0
BLAKE2b-256 checksum
How to use checksums
40f22f1ca70316305f4d48e1a40ff58355bed0318c0f72c6c20aaa6a3011c93b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 21, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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