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.30.tar.gz (17.6 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.30-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: safeexecute-0.0.30.tar.gz
  • Upload date:
  • Size: 17.6 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.30.tar.gz
Algorithm Hash digest
SHA256 d04e511152fb4c4ea26f6d364aa92c529d8fb9b2a72d41c65941722bc79a6b6c
MD5 a9a28a281730906ba88bdffcac085449
BLAKE2b-256 6818730cf60a2056e7981ae77e8975b93c97a237c48b0905785c1680c4710c8e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: safeexecute-0.0.30-py3-none-any.whl
  • Upload date:
  • Size: 17.0 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.30-py3-none-any.whl
Algorithm Hash digest
SHA256 0476fd31682c2566d48aabee1fe12bdfd12a2a494a75e8a689da47b79d8d9af8
MD5 2ff94010dc035d876dccaebd8cb7f7d7
BLAKE2b-256 63bd2e37d4d5b39cf5f2d7242a0151c408e280125f7c864525b6eb60cfd6445e

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