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.8.tar.gz
(3.5 kB
view hashes)
Built Distribution
Close
Hashes for safeexecute-0.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6f1b5e3274376b6e7fd7a8c465e5e7d9c702804bbacaa6d25ee1e363385d46e |
|
MD5 | fe0caba363b5f4ebcb31c47c60ec36c5 |
|
BLAKE2b-256 | bf1ee130a0bb4404b2a79f83fde4d232ed653f03c6b67e5ec4782de72d8b8704 |