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.6.tar.gz
(3.5 kB
view hashes)
Built Distribution
Close
Hashes for safeexecute-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f71c3914f34e35090b60b80cfd4b2c166d821a40f188dd57489ec6adbf8411d |
|
MD5 | 4ec4a2341be20a377988489a65c5496d |
|
BLAKE2b-256 | 7772a048dbca08fede3318a1913077ed8a27316c82b084020d205776d18079ff |