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.28.tar.gz (17.4 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.28-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: safeexecute-0.0.28.tar.gz
  • Upload date:
  • Size: 17.4 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.28.tar.gz
Algorithm Hash digest
SHA256 9852cb82c0a74fc02c0a06abf20b74cfa967393b893ccc53af1774b8d028cec6
MD5 103c993f48461bc76eefb8fe93fcf3db
BLAKE2b-256 66bfa5ce130b5cd79ff42edb40cb8364f336be6cbb5eec80b45554a7116146ea

See more details on using hashes here.

File details

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

File metadata

  • Download URL: safeexecute-0.0.28-py3-none-any.whl
  • Upload date:
  • Size: 16.7 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.28-py3-none-any.whl
Algorithm Hash digest
SHA256 fc8ece9d2ca895d033953fed6ad8349024f59ff11d00563831e701755fa13680
MD5 df335b5fc3859f862558d4795fac77bd
BLAKE2b-256 3de8e50dabd2e8daf0610d50aa70fb204aa04ddf0e929994edbde519fa4d5f82

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