NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #5775 most downloaded on PyPI
Patch the inner source of python functions at runtime.
Last release 1 months ago
21 Aug 2026
Ships fairly regularly
a new release about every 5 months
Nearly every release is documented
notes for 22 of 22 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
22 releases · first in 2015
Fix the temp_patch decorator form to return the decorated function’s return value.
Fix the temp_patch decorator form to return the decorated function’s return value.
Fix patching functions whose argument default values refer to names that are unavailable at patch time, such as class attributes or enclosing function locals. Such default value expressions previously raised NameError when re-evaluated during patching. They are now replaced with None before recompilation, since patchy discards their values anyway, keeping the original function’s default values.
PR #620. Thanks to Anton Kovalevich for the initial work in PR #431.
Store patched source with Python’s linecache module, under a per-function virtual filename like <patchy: example.some_func>. This makes tracebacks, pdb, inspect.getsource(), and other tools show the patched source code.
PR #621. Thanks to Michael Bianco for the initial work in PR #542.
One column per quarter.
Apply patches in-memory with unipatch __, a pure-Python implementation of unified diff built especially for patchy.
Apply patches in-memory with unipatch, a pure-Python implementation of unified diff built especially for patchy.
unipatch supersedes using the GNU patch commandline utility, speeding up patching significantly (milliseconds down to microseconds) and extending support to Windows. unipatch tries to follow the implementation of patch as closely as possible, so patches should continue to work.
Support Python 3.15.
Switch package build backend from setuptools to uv_build. This makes builds with uv about nine times faster, since uv runs the backend natively, without creating a build environment or spawning a Python process. Additionally, source distributions no longer include test files, which setuptools previously included incompletely, missing the files needed to actually run them.
Drop Python 3.9 support.
* Support Python 3.14.
Support Python 3.14.
* Drop Python 3.8 support. * Support Python 3.13.
Drop Python 3.8 support.
Support Python 3.13.
* Drop Python 3.7 support.
Drop Python 3.7 support.
* Support Python 3.12.
Support Python 3.12.
Use the --force flag to patch, so it doesn’t hang waiting input for invalid reverse patches. This seems to happen with the new version on macOS.
Use the --force flag to patch, so it doesn’t hang waiting input for invalid reverse patches. This seems to happen with the new version on macOS.
* Support Python 3.11.
Support Python 3.11.
* Drop Python 3.6 support.
Drop Python 3.6 support.
* Add type hints.
Add type hints.
Stop distributing tests to reduce package size. Tests are not intended to be run outside of the tox setup in the repository. Repackagers can use GitHu
Support Python 3.10.
Stop distributing tests to reduce package size. Tests are not intended to be run outside of the tox setup in the repository. Repackagers can use GitHub's tarballs per tag.
Move license from BSD to MIT License.
Drop Python 3.5 support.
Move license from BSD to MIT License.
Use Python 3.9's pkgutil.resolve_name() (docs __) to import names by strings, and depend on the backport package __ on older Python versions.
Support Python 3.9.
Use Python 3.9's pkgutil.resolve_name() (docs) to import names by strings, and depend on the backport package on older Python versions.
Drop Python 2 support, only Python 3.5-3.8 is supported now. Python 3.4 was dropped as it has reached its end of life.
Drop Python 2 support, only Python 3.5-3.8 is supported now. Python 3.4 was dropped as it has reached its end of life.
Converted setuptools metadata to configuration file. This meant removing the __version__ attribute from the package. If you want to inspect the installed version, use importlib.metadata.version("patchy") (docs / backport).
Support cases where the function or class name is not in the freevars. This allows patching __init__ of a class, or patching a recursive module-level
Support cases where the function or class name is not in the freevars. This allows patching __init__ of a class, or patching a recursive module-level function.
Support patching objects provided by dotted path string.
Added new function patchy.replace(), that can be used to directly assign new source code to a function, without having to make a patch.
Added new function patchy.replace(), that can be used to directly assign new source code to a function, without having to make a patch.
Support freevars and methods that call mangled methods.
Support freevars and methods that call mangled methods.
Fixed setup.py to not fix the version of six required.
Fixed setup.py to not fix the version of six required.
Fixed install instruction in README.
Added patchy.mc_patchface() as an alias for patchy.patch() because memes.
Remove dependency on pylru by using a simpler caching strategy
Remove dependency on pylru by using a simpler caching strategy
Patching caches the patched and unpatched versions, so unpatching and repeat patching/unpatching are both faster
Pirate mascot!
Patching caches the patched and unpatched versions, so unpatching and repeat patching/unpatching are both faster
Patching doesn't attach an attribute to the function object any more
Fixed code compilation to use the __future__ flags from the function that is being patched
Fixed code compilation to use the __future__ flags from the function that is being patched
Added unpatch method
Added temp_patch context manager/decorator
First release on PyPI, featuring patch function.
First release on PyPI, featuring patch function.
Your coding agent can read these notes before it upgrades. Set up the MCP server →