decopatch
Create decorators easily in python.
What it is and what it does
Decopatch is a library that removes the friction from writing Python decorators. Creating decorators typically requires careful handling of function signatures, argument passing, and wrapper metadata—tasks that are repetitive and error-prone. Decopatch provides utilities to generate decorators with minimal boilerplate, automatically preserving the decorated function's signature and handling both parameterized and non-parameterized decorator syntax.
The package depends on makefun (for signature generation), funcsigs, and enum34 (compatibility backports). It is marked Production/Stable and supports Python 2.7 through 3.9. The codebase is dormant but stable, with no known security vulnerabilities, making it a low-risk choice for projects that need straightforward decorator creation without active maintenance demands.
Use it for:
- Writing a logging decorator that wraps functions while preserving their original signatures and metadata.
- Creating a retry decorator that can be used with or without arguments (@retry or @retry(max_attempts=3)).
- Building a validation decorator that inspects function arguments before execution.
- Generating timing or profiling decorators that measure function execution without altering the wrapped function's interface.
- Implementing authorization or access-control decorators for web frameworks or APIs.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Decopatch simplifies writing decorators in Python by handling the boilerplate of preserving function signatures and managing decorator arguments, letting you focus on the decorator logic itself.
Yes, if you write decorators regularly and want to reduce boilerplate. The package is stable, carries no vulnerabilities, and has low install friction. However, be aware that maintenance is dormant—if you need active support or encounter edge cases, you may need to fork or maintain patches yourself. For standard decorator patterns on modern Python, consider whether the built-in functools.wraps and decorator patterns meet your needs first.
Install
decopatch on PyPI
pip
pip install decopatchuv
uv add decopatchpoetry
poetry add decopatchInstalling decopatch
Before you install
Low install friction with a pure-Python wheel. Maintenance is dormant—last release was in 2022 and the last commit in 2024—but the package is marked Production/Stable and carries no known vulnerabilities, so it is suitable for stable decorator patterns that do not require active development.
License in practice
BSD 3-Clause is permissive, allowing commercial and private use with minimal restrictions. You must include a copy of the license and retain copyright notices, but there are no copyleft obligations.
Quickstart
pip install decopatch
from decopatch import decorator
@decorator
def my_decorator(func, *args, **kwargs):
return func(*args, **kwargs)
@my_decorator
def my_function():
pass
Verify before relying
- Whether enum34 and funcsigs are truly needed on modern Python versions (they are typically backports for Python 2.7 and early Python 3).
- Specific decorator patterns or edge cases the package handles beyond standard function wrapping.
Package facts
| License | BSD 3-Clause (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — makefun, funcsigs, enum34 |
| Maintenance | dormant — 1,627 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,736,077/month — #3,606 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: decopatch-1.4.10-py2.py3-none-any.whl
Keywords: decorate, decorator, function, class, parenthesis, generate, generation, define, definition, signature, args, wrapper, wraps, auto, easy, preserve
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
decoratorProvides utilities for writing function…
permissive · top 1,000 on PyPI
makefunDynamically creates Python functions at runtime…
permissive · top 5,000 on PyPI
purifyA decorator that makes object-mutating…
permissive · top 15,000 on PyPI
sigtoolsSigtools provides utilities to inspect and…
permissive · top 5,000 on PyPI
tightwrapA drop-in replacement for `functools.wraps`…
permissive · top 15,000 on PyPI
wraptwrapt provides a Python module for building…
permissive · top 100 on PyPI
undecoratedStrips decorators from Python functions,…
permissive · top 15,000 on PyPI
AutologgingAutologging provides decorators to…
permissive · top 15,000 on PyPI
django-annoyingProvides a collection of Django utility…
permissive · top 15,000 on PyPI
backcallbackcall lets you define and validate callback…
permissive · top 5,000 on PyPI