Metadata-Version: 2.1
Name: PyJail
Version: 0.1.1
Summary: A Python module for sandboxing code execution.
Home-page: https://github.com/mrigankpawagi/PyJail
Author: Mrigank Pawagi
Author-email: Mrigank Pawagi <mrigankpawagi@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/mrigankpawagi/PyJail
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX :: Linux
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE.txt

# PyJail

PyJail is a Python module designed to provide a secure environment for executing untrusted code. PyJail is available on [PyPI](https://pypi.org/project/PyJail/).

```bash
pip install PyJail
```

To execute a function without access to your system, call it through PyJail as shown below.

```python
from pyjail import Jail

with Jail() as jail:
    result = jail.execute(untrusted_func, *func_args, **func_kwargs)
```

The `Jail` class constructor has the optional parameters `path=os.path.join(os.getcwd(), "jail")` and `clear_before_create=True`. The `path` parameter specifies the directory where the jail will be created (note that this is a transient directory that will be deleted when the `Jail` object is destroyed) and the `clear_before_create` parameter specifies whether the jail directory should be cleared before creation (if it already exists).

> [!NOTE]
> You must run your python script as root to create a jail.
