#wrapt

[ follow ]
fromGrahamdumpleton
1 day ago

Detecting object wrappers - Graham Dumpleton

The best example of this and the reason that wrapt was created in the first place, is to instrument existing Python code to collect metrics about its performance when run in production. Since one cannot expect a customer for an application performance monitoring (APM) service to modify their code, as well as code of the third party dependencies they may use, transparently reaching in and monkey patching code at runtime is the best one can do.
Python
Python
fromGrahamdumpleton
5 days ago

Wrapt version 2.0.0 - Graham Dumpleton

wrapt 2.0.0 is released with removed Python 2.7 accommodations, subtle internal changes, and a major version bump applied out of caution.
Python
fromGrahamdumpleton
1 week ago

Wrapping immutable objects - Graham Dumpleton

ObjectProxy lacked support for several Python special dunder methods, notably matrix multiplication and in-place operator behaviors, delaying wrapt 2.0.0.
fromGrahamdumpleton
3 weeks ago

Lazy imports using wrapt - Graham Dumpleton

The actual reason wrapt was created was to be able to perform monkey patching of Python code. One key aspect of being able to monkey patch Python code is to be able to have the ability to wrap target objects in Python with a wrapper which acts as a transparent object proxy for the original object. By extending the object proxy type, one can then intercept access to the target object to perform specific actions.
Software development
fromGrahamdumpleton
1 month ago

Status of wrapt (September 2025) - Graham Dumpleton

Back then, constructing decorators using function closures had various short comings and the resulting wrappers didn't preserve introspection and various other attributes associated with the wrapped function. Many of these issues have been resolved in updates to Python and the functools.wraps helper function, but wrapt based decorators were still useful for certain use cases such as being able to create a decorator where you could work out whether it was applied to a function, instance method, class method or even a class.
[ Load more ]