module-wrapper - module wrapper Python library (maintenance mode)
Warning
Authors of aioify and module-wrapper decided to discontinue support of these libraries since the idea: "let's convert sync libraries to async ones" works only for some cases. Existing releases of libraries won't be removed, but don't expect any changes since today. Feel free to fork these libraries, however, we don't recommend using the automatic sync-to-async library conversion approach, as unreliable. Instead, it's better to run synchronous functions asynchronously using https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.run_in_executor or https://anyio.readthedocs.io/en/stable/api.html#running-code-in-worker-threads.
Old documentation
module-wrapper contains wrap function, which is used to wrap module, class, function or another variable
recursively.
Installation
To install from PyPI run:
$ pip install module-wrapper
Usage
Example from aioify:
from functools import wraps, partial
import asyncio
import module_wrapper
__all__ = ['aioify']
def wrap(func):
@wraps(func)
async def run(*args, loop=None, executor=None, **kwargs):
if loop is None:
loop = asyncio.get_event_loop()
pfunc = partial(func, *args, **kwargs)
return await loop.run_in_executor(executor, pfunc)
return run
def aioify(obj, name=None):
def create(cls):
return 'create', wrap(cls)
return module_wrapper.wrap(obj=obj, wrapper=wrap, methods_to_add={create}, name=name)
Metadata
Release files for module-wrapper 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| module-wrapper-0.3.2.tar.gz | 10.8 kB | Without provenance | Details for module-wrapper-0.3.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| module_wrapper-0.3.2-py3-none-any.whl | Python 3 | none | any | Details for module_wrapper-0.3.2-py3-none-any.whl |
Total release size: 21.7 kB
Release files / module-wrapper-0.3.2.tar.gz
| Download URL | module-wrapper-0.3.2.tar.gz |
|---|---|
| Size | 10.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6fc9873df249cfc251b33328b35a3ec3c96d2d424576bc6a3ec5e8fd161bb418
|
|
BLAKE2b-256 checksum How to use checksums |
29bc8e0ebfbd903c18d40287b17452d30f09dd35d4001c9ccffed98068139c43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.9.7 Linux/5.16.15-1-default
|
Release files / module_wrapper-0.3.2-py3-none-any.whl
| Download URL | module_wrapper-0.3.2-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
28b52a8407123e727eb846bc9b12d1503988644374ff7b92ac328e874db9a054
|
|
BLAKE2b-256 checksum How to use checksums |
3fd162abbf73ea06893059db0bc85b7cbd3593bfb5af07d4e1e8ccf05f0eae90
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.9.7 Linux/5.16.15-1-default
|
Security for module-wrapper 0.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.