python-monkey-business is a Python package offering utility functions for monkey-patching code at runtime. It primarily provides a decorator to replace functions within classes or modules. The current version is 1.1.0, with the latest package upload on PyPI on July 11, 2024, though the project appears to have a very infrequent release cadence.
pip install python-monkey-businessVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to use the `monkeybiz.patch` decorator to replace a method within a class and how to revert the patch using `monkeybiz.unpatch`.
Prefer composition, inheritance, or dependency injection over monkey patching when possible. Document all monkey patches thoroughly.
If you intend to layer multiple patches, set `avoid_doublewrap=False` in the decorator. Always use `monkeybiz.unpatch()` to revert patches when they are no longer needed, especially in testing contexts, to prevent unexpected side effects.
Ensure your decorated patch function always has `original_fn` as its first parameter to correctly wrap the original functionality.
Evaluate the stability and community support before relying heavily on this library for critical production systems. Consider forking if custom modifications or active maintenance are required.
No dependency data recorded yet.