Skip to main content

Safe way to execute Python code with containerization.

Project description

SafeExecute

GitHub PayPal Ko-Fi

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
  • agixtsdk

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


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.25.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

safeexecute-0.0.25-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file safeexecute-0.0.25.tar.gz.

File metadata

  • Download URL: safeexecute-0.0.25.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for safeexecute-0.0.25.tar.gz
Algorithm Hash digest
SHA256 9b359ba8b385dd05ba4fb0c3fb8615b352d5d9561aef2e6d4cb706c40140dc1d
MD5 ccd81190d0bdf9813dd3ce3b47cfb637
BLAKE2b-256 0aa14fea3aae9859ba3e92de54cf39a81f726d88afe9374b38f071a42fdcdc33

See more details on using hashes here.

File details

Details for the file safeexecute-0.0.25-py3-none-any.whl.

File metadata

  • Download URL: safeexecute-0.0.25-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for safeexecute-0.0.25-py3-none-any.whl
Algorithm Hash digest
SHA256 345ae568bc501c257699e15a1a4eb23ee77e9e17ec0ebbd6b87d0f19ce44dc6b
MD5 4e037bc006e8978824132d3da7efd01b
BLAKE2b-256 e52f3ded637569a5968cb9bdb46a9bac47bb8bd0e5b7c31844fe44352e7f0ce4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page