python-wrapt
Port variant v13
Summary Decorators, wrappers and monkey patching (3.13)
Package version 2.0.1
Homepage https://github.com/GrahamDumpleton/wrapt
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants v14
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 11 NOV 2025, 14:16:56 UTC
Port created 30 NOV 2020, 06:56:42 UTC
Subpackage Descriptions
single wrapt ===== |PyPI| |Documentation| A Python module for decorators, wrappers and monkey patching. Overview -------- The **wrapt** module provides a transparent object proxy for Python, which can be used as the basis for the construction of function wrappers and decorator functions. The **wrapt** module focuses very much on correctness. It goes way beyond existing mechanisms such as ``functools.wraps()`` to ensure that decorators preserve introspectability, signatures, type checking abilities etc. The decorators that can be constructed using this module will work in far more scenarios than typical decorators and provide more predictable and consistent behaviour. To ensure that the overhead is as minimal as possible, a C extension module is used for performance critical components. An automatic fallback to a pure Python implementation is also provided where a target system does not have a compiler to allow the C extension to be compiled. Key Features ------------ * **Universal decorators** that work with functions, methods, classmethods, staticmethods, and classes * **Transparent object proxies** for advanced wrapping scenarios * **Monkey patching utilities** for safe runtime modifications * **C extension** for optimal performance with Python fallback * **Comprehensive introspection preservation** (signatures, annotations, etc.) * **Thread-safe decorator implementations** Installation ------------ Install from PyPI using pip:: pip install wrapt Supported Python Versions -------------------------- * Python 3.8+ * CPython and PyPy implementations Documentation ------------- For comprehensive documentation, examples, and advanced usage patterns, visit: * https://wrapt.readthedocs.io/ Quick Start ----------- To implement your decorator you need to first define a wrapper function. This will be called each time a decorated function is called. The wrapper function needs to take four positional arguments: * wrapped - The wrapped function which in turns needs to be called by your wrapper function. * instance - The object to which the wrapped function was bound when it was called. * args - The list of positional arguments supplied when the decorated function was called. * kwargs - The dictionary of keyword arguments supplied when the decorated function was called. The wrapper function would do whatever it needs to, but would usually in turn call the wrapped function that is passed in via the wrapped argument. The decorator ``@wrapt.decorator`` then needs to be applied to the wrapper function to convert it into a decorator which can in turn be applied to other functions.
Configuration Switches (platform-specific settings discarded)
PY313 ON Build using Python 3.13 PY314 OFF Build using Python 3.14
Package Dependencies by Type
Build (only) python313:dev:std
python-pip:single:v13
autoselect-python:single:std
Build and Runtime python313:primary:std
Download groups
main mirror://PYPIWHL/15/d1/b51471c11592ff9c012bd3e2f7334a6ff2f42a7aed2caffcf0bdddc9cb89
Distribution File Information
4d2ce1bf1a48c5277d7969259232b57645aae5686dba1eaeade39442277afbca 44046 python-src/wrapt-2.0.1-py3-none-any.whl
Ports that require python-wrapt:v13
python-Deprecated:v13 Implements @deprecated decorator (3.13)