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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file modwrap-1.0.1.tar.gz.
File metadata
- Download URL: modwrap-1.0.1.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49f38aa35da1b384d826bf94298482ff2b2e5c1a03abc0c134c78ef55f26e1af
|
|
| MD5 |
d852bbb5104c48356c6c433ea8f22c12
|
|
| BLAKE2b-256 |
77a399cd7c96f30a6de26a130d2654884b61f4d4f679c7bc7c7248d0b44d7fe0
|
File details
Details for the file modwrap-1.0.1-py3-none-any.whl.
File metadata
- Download URL: modwrap-1.0.1-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eabe0b678fc5644cc097c2e2ca9e98071414e3203c64592957aa80feb6241659
|
|
| MD5 |
4a94ab249a7a49f1c0c3150069374f2a
|
|
| BLAKE2b-256 |
dbd91c0e468df1f274f13db27cfd92d146c9f8d22d1a17854cb0eecaf3edb08a
|