#monkey-patching

[ follow ]
Software development
fromGlyph
4 days ago

The "Dependency Cutout" Workflow Pattern, Part I

Upstream open-source bugs require careful resolution because replacing, vendoring, monkey-patching, or local workarounds each impose substantial long-term costs and risks.
fromGrahamdumpleton
3 weeks 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
fromGrahamdumpleton
2 months 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 ]