Metadata-Version: 2.5
Name: lupaxa-sandbox
Version: 0.1.0
Summary: Run commands in disposable workspaces and inspect what they change.
Project-URL: Homepage, https://github.com/lupaxa-developers-toolbox/sandbox
Project-URL: Documentation, https://sandbox.thelupaxaproject.org/
Project-URL: Repository, https://github.com/lupaxa-developers-toolbox/sandbox
Project-URL: Issues, https://github.com/lupaxa-developers-toolbox/sandbox/issues
Author: The Lupaxa Project
License: MIT License
        
        Copyright (c) The Lupaxa Project
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENCE
Keywords: cli,filesystem,sandbox,workspace
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development
Classifier: Topic :: Utilities
Requires-Python: >=3.11
Requires-Dist: pathspec>=0.12
Requires-Dist: platformdirs>=4
Requires-Dist: pydantic>=2
Requires-Dist: pyyaml>=6
Requires-Dist: rich>=13
Requires-Dist: typer>=0.12
Provides-Extra: dev
Requires-Dist: bump-my-version>=1.2.0; extra == 'dev'
Requires-Dist: hatch>=1.12.0; extra == 'dev'
Requires-Dist: mypy>=1.12.0; extra == 'dev'
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.6.0; extra == 'dev'
Requires-Dist: textual>=1.0; extra == 'dev'
Provides-Extra: test
Requires-Dist: pytest-cov>=5.0; extra == 'test'
Requires-Dist: pytest>=8.0; extra == 'test'
Provides-Extra: tui
Requires-Dist: textual>=1.0; extra == 'tui'
Description-Content-Type: text/markdown

<p align="center">
  <a href="https://github.com/lupaxa-developers-toolbox">
    <img src="https://raw.githubusercontent.com/the-lupaxa-project/brand-assets/master/logos/organisations/developers-toolbox/readme-logo.png" alt="Developers Toolbox" />
  </a>
</p>

<h1 align="center">Sandbox</h1>

Sandbox runs commands in a disposable copy of a project and shows what
those commands changed. The original project stays in place.

> **Note:** A workspace is a copied directory, not a security boundary. A
> command still runs with your user permissions.

The PyPI name is `lupaxa-sandbox`. The import path is `lupaxa.sandbox`.
The console script is `sandbox`. `lupaxa` is a namespace package — there
is no `lupaxa/__init__.py`.

## Install

```bash
pip install lupaxa-sandbox
```

Python 3.11 or newer is required.

## Run

```bash
sandbox run -- python -c "open('generated.txt', 'w').write('ok\n')"
sandbox list
sandbox diff run-name
sandbox logs run-name
sandbox destroy run-name
```

`sandbox run` copies the current directory, runs the command in that copy,
and prints what was added, changed, or deleted. The copy is kept until
you destroy the session. Put the command after `--` so Sandbox does not
treat it as its own options. Add `--shell` only when you want a shell to
expand the command.

`sandbox --help` and `sandbox --version` print usage and the package
version. `--json` prints a machine-readable report. A normal command
failure returns that command's exit code. A timeout returns exit code 5.

## Isolation

```bash
sandbox backend list
sandbox run --backend restricted --network deny -- python -c "open('out.txt', 'w').write('ok')"
```

The local backend is the default. It runs as you and does not restrict
files, the network, or processes. `restricted`, `docker`, and `podman`
are used only when a probe says they work. A limit the selected backend
cannot enforce is refused. Sandbox does not switch to a weaker backend,
and it does not pull container images.

## Compare

```bash
sandbox compare sandbox.yml --python-a python3.11 --python-b python3.12
sandbox tui
```

`sandbox compare` stages the project once and runs that same snapshot in
two sessions. The report lists exit codes, output, and files that
differ. A difference is an observation. It does not mean the commands
are incompatible. `sandbox tui` browses sessions, diffs, and export.
Install it with `pip install "lupaxa-sandbox[tui]"`. A normal install
does not include it.

## Recipes

```bash
sandbox validate sandbox.yml
sandbox run sandbox.yml
sandbox config show --resolved
```

A recipe lists commands as argument arrays and can create a virtual
environment with an interpreter that is already installed. Sandbox does
not download Python. The environment is not a security boundary.
`sandbox validate` checks the file before it creates a workspace.

## Keep Results

```bash
sandbox export experiment-1 --include "dist/**" --to ./output/
sandbox apply experiment-1 --all --dry-run
sandbox clean --dry-run
sandbox storage
```

Export copies the files you name. Apply writes changes back only when
the original files still match the snapshot from session creation. A
file you edited after that is left alone and reported as a conflict.
Deletes need `--delete`. `sandbox clean` does not remove a session that
is still running.

## Samples

The repository has three ready-to-run projects under `samples/`. This is
the smallest:

```bash
sandbox validate samples/hello/sandbox.yml
sandbox run samples/hello/sandbox.yml
sandbox diff hello
sandbox destroy hello
```

`samples/report` builds a file and checks it. `samples/compare-notes`
runs one snapshot twice so you can compare the results.

## Documentation

The guide lives in `mkdocs/` and publishes to
<https://sandbox.thelupaxaproject.org/>.
It has install steps, session and recipe usage, a command reference, and
a walkthrough of each sample with commands you can paste.

```bash
pip install -r requirements.txt
mkdocs serve
```

## Development

```bash
make init
make python-install-dev
make python-check
```

<a href="https://github.com/the-lupaxa-project">
    <img src="https://raw.githubusercontent.com/the-lupaxa-project/brand-assets/master/logos/components/footer-for-child-orgs.svg" alt="The Lupaxa Project Footer" width="100%" />
</a>
