decorator
Decorators for Humans
Decision gist · record as of 2026-08-14
Yes. This is a stable, zero-dependency utility that solves a real Python problem: signature-preserving decorators are tedious to write correctly by hand. The module is actively maintained, permissively licensed, and widely trusted in the ecosystem. Install it if you write decorators or need multiple dispatch; skip it only if you never use decorators or are willing to use functools.wraps manually.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction: pure Python wheel with no runtime dependencies, installs instantly.
- Actively maintained with a release within the last 88 days.
License · maintenance · safety
BSD-2-Clause (permissive) — BSD-2-Clause (permissive): you can use, modify, and distribute freely with minimal restrictions; original license notice required.
last release 2026-05-18 (88 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 241,108,642 downloads/mo, #164 on PyPI
Alternatives
Verify before relying
pip install decorator
from decorator import decorator
import time
@decorator
def warn_slow(func, timelimit=60, *args, **kw):
t0 = time.time()
result = func(*args, **kw)
dt = time.time() - t0
if dt > timelimit:
print(f'{func.__name__} took {dt} seconds')
return result
@warn_slow(timelimit=5)
def my_function():
pass- Whether multiple dispatch implementation is feature-complete or limited compared to dedicated dispatch libraries.
- Performance characteristics when decorating functions with many arguments or complex signatures.
What it is and what it does
The decorator module solves the problem of writing function decorators that automatically preserve the original function's signature and metadata. When you write a decorator without this library, the decorated function loses its original `__name__`, `__doc__`, and parameter information—making debugging harder and breaking introspection-based tools. This module provides a `@decorator` wrapper that handles that preservation automatically, so your decorator can focus on its logic.
It also includes a multiple dispatch implementation and other utilities for decorator patterns. The package has no runtime dependencies, supports Python 3.8 through 3.14, and is classified as production-stable. It's widely used in the ecosystem (top 1000 by downloads) and has maintained backward compatibility since its early releases.
Use it for
- Write timing or logging decorators that need to report the original function name and signature correctly.
- Build decorator factories that accept parameters while preserving the decorated function's metadata.
- Implement multiple dispatch (function overloading by argument type) in Python code.
- Create retry or caching decorators that must preserve introspection for debugging and documentation.
- Develop library decorators where users expect the decorated function to behave transparently in stack traces and help().
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
This is a stable, zero-dependency utility that solves a real Python problem: signature-preserving decorators are tedious to write correctly by hand. The module is actively maintained, permissively licensed, and widely trusted in the ecosystem. Install it if you write decorators or need multiple dispatch; skip it only if you never use decorators or are willing to use functools.wraps manually.
Install
decorator on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies, installs instantly. Actively maintained with a release within the last 88 days.
License in practice
BSD-2-Clause (permissive): you can use, modify, and distribute freely with minimal restrictions; original license notice required.
Quickstart
pip install decorator
from decorator import decorator
import time
@decorator
def warn_slow(func, timelimit=60, *args, **kw):
t0 = time.time()
result = func(*args, **kw)
dt = time.time() - t0
if dt > timelimit:
print(f'{func.__name__} took {dt} seconds')
return result
@warn_slow(timelimit=5)
def my_function():
pass
Verify before relying
- Whether multiple dispatch implementation is feature-complete or limited compared to dedicated dispatch libraries.
- Performance characteristics when decorating functions with many arguments or complex signatures.
Package facts
| License | BSD-2-Clause permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 88 days since the last release |
| First released | |
| Downloads | 241,108,642 / month, #164 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development :: LibrariesTopic :: Utilities |
Evidence: decorator-5.3.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “signature-preserving decorators”
- decoratorProvides utilities for writing function decorators that preserve the…
- django-decorator-includeApplies decorators to Django URL patterns included from other…
- fastapi-decoratorsConverts functions into FastAPI-compatible decorators that can inject…
Give your agent the search over MCP, or paste the wish link into any chat.
More Libraries packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.
Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
See also decopatch · wrapt · multimethod · sigtools · makefun · fastapi-decorators · undecorated · methoddispatch · essentials · venusian