Safe way to execute Python code with containerization.
Project description
SafeExecute
This module provides a safe way to execute Python code in a container. It is intended to be used with language models to enable them to execute code in a safe environment separate from the host machine (your computer or server).
The container comes preloaded with the following packages:
numpy matplotlib seaborn scikit-learn yfinance scipy statsmodels sympy bokeh plotly dash networkx pyvis pandas
Installation
pip install safeexecute
Usage
Set your working directory which is where any potential outputs of the code will be stored. This is also where the code will be executed.
from safeexecute import execute_python_code
working_directory = os.path.join(os.getcwd(), "WORKSPACE")
code = "print('Hello, World!')"
result = execute_python_code(code=code, working_directory=working_directory)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
safeexecute-0.0.4.tar.gz
(3.4 kB
view hashes)
Built Distribution
Close
Hashes for safeexecute-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62c97e809d8b9bd85f1ceed9116d126704b3adbf9a8ad717cb45450b08c5c3fa |
|
MD5 | 6aa09a4e356c50f0172084eb74039f49 |
|
BLAKE2b-256 | 9a7c076b55a780de6a146833830410d73ec933ce7068f188005dd6e78534c52a |