skillfed

decopatch

Create decorators easily in python.

decopatch v1.4.10 1.7M downloads/30d#3,606 on PyPI25
Permissive license BSD 3-Clause DORMANT released

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 decopatch

uv

uv add decopatch

poetry

poetry add decopatch

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules

Tags

python decorator creationdecorator with argumentspreserve function signaturedecorator boilerplateeasy decorator libraryfunction wrapping utilitiesdecorator generator
decorator-utilitiespython-2-compatible

More Python Modules packages