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.29.tar.gz (17.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.29-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for safeexecute-0.0.29.tar.gz
Algorithm Hash digest
SHA256 d26e6bb4a0423c0179739c15f35067069be588c3db28451f47019c3ccf57e78b
MD5 f4f937f3199b84840efba2b9b068e249
BLAKE2b-256 613b037425123c8d0457e3e44a6c49760fda4f1301f629f7f12033157039a03f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for safeexecute-0.0.29-py3-none-any.whl
Algorithm Hash digest
SHA256 117548c06ece64376231caa685ce187acbf08953fcf156eb37f80d4955fe4ad0
MD5 fd36f716f4c97125c217edbc5f76e473
BLAKE2b-256 c7bba2de520cbf0dc957dfa45f5b48a2eda8a32885cec8d8b0209329118d4d30

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