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.7.tar.gz
(3.6 kB
view hashes)
Built Distribution
Close
Hashes for safeexecute-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f110687299e2c093c862349b051668202c71a0f6c3e3c10c036da33fe7f2d556 |
|
MD5 | fcd84e7cc6b250ccf8632129e94a258a |
|
BLAKE2b-256 | fbdeabda158ba304bd0baa4776a2a7ce4a48e4f0d3fc189544b156c299d45f33 |