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
You can pass an entire message from a langauge model into the code
field and it will parse out any Python code blocks and execute them. If anywhere in the code
says pip install <package>
, it will install the package in the container before executing the code.
from safeexecute import execute_python_code
code = "print('Hello, World!')"
result = execute_python_code(code=code)
print(result)
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.9.tar.gz
(3.6 kB
view hashes)
Built Distribution
Close
Hashes for safeexecute-0.0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fbe327de41a798bdab3b1ca28350ac8c6e1f0f1a7ec03f7b916d976cbf1d62c5 |
|
MD5 | 862e06fcc0e1dff5e03c812e39765ac0 |
|
BLAKE2b-256 | c711579afac4d93dfa67cb2f7c2cc986ad903f1330481adef98cdef58aee7f6b |