modwrap


Namemodwrap JSON
Version 1.1.3 PyPI version JSON
download
home_pagehttps://github.com/n3rada/modwrap
SummaryPython module wrapper for dynamic loading and callable signature validation.
upload_time2025-07-11 17:21:54
maintainern3rada
docs_urlNone
authorn3rada
requires_python<4.0,>=3.9
licenseGPL-3.0-or-later
keywords wrapper module code dynamic loading signature validation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            **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](https://pypi.org/project/modwrap/):
```shell
pip install modwrap
```

## 🔧 Programmatic Usage

Use `modwrap` in your Python code to load modules, introspect callable signatures, and execute functions dynamically:

```python
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)
```

You can also access the raw module object:

```shell
mod = wrapper.module
print(mod.execute("whoami"))
```


## 💻 CLI Usage

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


### List available callables and their signatures

```shell
modwrap list ./examples/shell.py
```
Returns a JSON-formatted list of top-level functions with argument type hints.


### Get docstrings

```shell
modwrap doc ./examples/shell.py --full
```

### Call a function with positional arguments

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

### Call a function with keyword arguments

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


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/n3rada/modwrap",
    "name": "modwrap",
    "maintainer": "n3rada",
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": "72791564+n3rada@users.noreply.github.com",
    "keywords": "wrapper, module, code, dynamic, loading, signature, validation",
    "author": "n3rada",
    "author_email": "72791564+n3rada@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/6e/a2/05d3069895b727299dd0567f6156a65b128c44136f5fc779f8cb38f667a0/modwrap-1.1.3.tar.gz",
    "platform": null,
    "description": "**modwrap** is a pure Python 3 utility (no external dependencies) that lets you dynamically load and execute functions from any Python module \u2014 either via code or command line. \ud83d\udc0d\n\n## \ud83d\udce6 Installation\n\nInstall directly from [PyPI](https://pypi.org/project/modwrap/):\n```shell\npip install modwrap\n```\n\n## \ud83d\udd27 Programmatic Usage\n\nUse `modwrap` in your Python code to load modules, introspect callable signatures, and execute functions dynamically:\n\n```python\nfrom modwrap import ModuleWrapper\n\nwrapper = ModuleWrapper(\"./examples/shell.py\")\n\n# Optional: Validate the function signature before calling\nwrapper.validate_signature(\"execute\", {\"command\": str})\n\n# Load and call the function\nfunc = wrapper.get_callable(\"execute\")\nresult = func(command=\"whoami\")\nprint(result)\n```\n\nYou can also access the raw module object:\n\n```shell\nmod = wrapper.module\nprint(mod.execute(\"whoami\"))\n```\n\n\n## \ud83d\udcbb CLI Usage\n\n`modwrap` comes with a command-line interface to easily inspect and interact with any Python module.\n\n\n### List available callables and their signatures\n\n```shell\nmodwrap list ./examples/shell.py\n```\nReturns a JSON-formatted list of top-level functions with argument type hints.\n\n\n### Get docstrings\n\n```shell\nmodwrap doc ./examples/shell.py --full\n```\n\n### Call a function with positional arguments\n\n```shell\nmodwrap call ./examples/shell.py execute \"ls -tAbl\"\n```\n\n### Call a function with keyword arguments\n\n```shell\nmodwrap call ./examples/shell.py execute --kwargs '{\"command\": \"ls -tAbl\"}'\n```\n\n",
    "bugtrack_url": null,
    "license": "GPL-3.0-or-later",
    "summary": "Python module wrapper for dynamic loading and callable signature validation.",
    "version": "1.1.3",
    "project_urls": {
        "Homepage": "https://github.com/n3rada/modwrap",
        "Repository": "https://github.com/n3rada/modwrap"
    },
    "split_keywords": [
        "wrapper",
        " module",
        " code",
        " dynamic",
        " loading",
        " signature",
        " validation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7030eaacbb3f9473a3bd0f43a088ae55e5fb9611e9c5d949c01d365e617e6e9d",
                "md5": "3e55be1554f1e862967563052b7be05d",
                "sha256": "42a7dd2bdd2932b4d2e0264a28710b784932672c15acd9c134b1e4197645febd"
            },
            "downloads": -1,
            "filename": "modwrap-1.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3e55be1554f1e862967563052b7be05d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 20236,
            "upload_time": "2025-07-11T17:21:53",
            "upload_time_iso_8601": "2025-07-11T17:21:53.100196Z",
            "url": "https://files.pythonhosted.org/packages/70/30/eaacbb3f9473a3bd0f43a088ae55e5fb9611e9c5d949c01d365e617e6e9d/modwrap-1.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6ea205d3069895b727299dd0567f6156a65b128c44136f5fc779f8cb38f667a0",
                "md5": "5954e0427e2658591def559826e412c2",
                "sha256": "108798e9ec8148756b427052df6dcefbb1c95ebd6382cd45f317e3aa95c3dfc3"
            },
            "downloads": -1,
            "filename": "modwrap-1.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "5954e0427e2658591def559826e412c2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 18313,
            "upload_time": "2025-07-11T17:21:54",
            "upload_time_iso_8601": "2025-07-11T17:21:54.459272Z",
            "url": "https://files.pythonhosted.org/packages/6e/a2/05d3069895b727299dd0567f6156a65b128c44136f5fc779f8cb38f667a0/modwrap-1.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-11 17:21:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "n3rada",
    "github_project": "modwrap",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "modwrap"
}
        
Elapsed time: 1.15402s