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.32.tar.gz (18.9 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.32-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: safeexecute-0.0.32.tar.gz
  • Upload date:
  • Size: 18.9 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.32.tar.gz
Algorithm Hash digest
SHA256 cee7f62f71031e9e5ce6ae24a474981a325b1b31683835aebb576461d1d4245f
MD5 d57153413cf98e9dde0450e30da4e781
BLAKE2b-256 b4a32f207acb9003e3784a88166f30cf58ffca6e5548e38a6fa08716fa12c169

See more details on using hashes here.

File details

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

File metadata

  • Download URL: safeexecute-0.0.32-py3-none-any.whl
  • Upload date:
  • Size: 18.3 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.32-py3-none-any.whl
Algorithm Hash digest
SHA256 d10b7c1d1b2041d481b4cf3e76fe23c49248579767ab306fe6839963b35b5261
MD5 808b57885329b5ae51971377c102ac50
BLAKE2b-256 a7f4a5955d669c154a28979d4a3ac5845ca43fd57e5ac4ca74b8b54213b781b7

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