Skip to main content

Python module wrapper for dynamic loading and callable signature validation.

Project description

modwrap is a pure Python 3 utility (no external dependencies) that lets you dynamically load and execute functions from any Python module — either via code or command line. 🐍

📦 Installation

Install directly from PyPI:

pip install modwrap

🔧 Programmatic Usage

Use modwrap directly in your Python code to load modules, validate function signatures, and execute them safely:

from modwrap import ModuleWrapper

wrapper = ModuleWrapper("./examples/shell.py")

# Optional: Validate the function signature before calling
wrapper.validate_signature("execute", {"command": str})

# Load and call the function
func = wrapper.get_callable("execute")
result = func(command="whoami")
print(result)

💻 CLI Usage

modwrap comes with a command-line interface to easily inspect and interact with any Python module.

List available callables and their signatures

modwrap list ./examples/shell.py

Call a function with positional arguments

modwrap call ./examples/shell.py execute "ls -tAbl"

Call a function with keyword arguments

modwrap call ./examples/shell.py execute --kwargs '{"command": "ls -tAbl"}'

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

modwrap-1.0.2.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

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

modwrap-1.0.2-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

Details for the file modwrap-1.0.2.tar.gz.

File metadata

  • Download URL: modwrap-1.0.2.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.9 Linux/6.12.13-amd64

File hashes

Hashes for modwrap-1.0.2.tar.gz
Algorithm Hash digest
SHA256 15d4ec0c9ddc80793a3e62359cbe888edaf2b91037dc0c8c2f0f852ebfcc7b53
MD5 be8363c5e5fa456c2a3a6b594029146a
BLAKE2b-256 f0f56414b541ed720c436d6123874d46c1b537a7f1561aecdaeec76090c24ef5

See more details on using hashes here.

File details

Details for the file modwrap-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: modwrap-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 17.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.9 Linux/6.12.13-amd64

File hashes

Hashes for modwrap-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 23da1b62a868786fdc32c4bb8a85ef90edd7fa5cbe59b3219db2ddb99983d610
MD5 c0be60cd61fd5bd7cb1866842ffc5df9
BLAKE2b-256 5c1efaa04fcfc844a8c688bb14ae25cf19113b516babb18ad513b3c505ab707a

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