decorator
Decorators for Humans
This package has a good security score with no known vulnerabilities.
Community Reviews
Lightweight utility for signature-preserving decorators with minimal overhead
Day-to-day usage is straightforward - you write decorator factories that maintain proper `__name__`, `__doc__`, and argument signatures automatically. This becomes essential when decorating functions with complex signatures or keyword-only arguments. The library is stable with minimal breaking changes between versions, which is exactly what you want for low-level infrastructure code.
The main limitation is its narrow scope - it's not a full decorator utilities library. No built-in retry logic, rate limiting, or caching decorators. You're getting signature preservation, period. Documentation is adequate but sparse on edge cases. Memory footprint is minimal, no connection pooling or resource management needed since it's purely functional transformation code.
Best for: Building custom decorators that need accurate signature preservation for tooling, monitoring, or API documentation generation.
Avoid if: You need pre-built decorators for retry logic, caching, or rate limiting - use tenacity or functools instead.
Solid utility for signature-preserving decorators, but niche use case
The learning curve is reasonable if you already understand decorators, though the documentation could use more real-world examples. The README covers basic usage, but I found myself needing to experiment to understand the `caller` pattern. Error messages are straightforward when you pass wrong types, though they won't hold your hand if you misunderstand decorator mechanics generally.
Day-to-day usage is smooth once you grasp the pattern. It's particularly valuable when building libraries where good introspection matters. Community support is limited due to the package's narrow scope—most questions are answered in existing GitHub issues, but don't expect quick responses. For most projects, Python's built-in `functools.wraps` is sufficient, but when you need perfect signature preservation, this delivers.
Best for: Library authors who need decorators with perfect signature preservation for documentation and type checking tools.
Avoid if: You're writing simple application-level decorators where functools.wraps provides adequate signature handling.
Solid utility for signature-preserving decorators with minimal attack surface
From a security perspective, this package has an excellent profile. It's a small, focused codebase with minimal dependencies (essentially none beyond stdlib), which dramatically reduces supply chain risk. The code is straightforward Python with no network operations, file I/O, or dangerous dynamic evaluation. It doesn't handle user input directly or perform any authentication/authorization, so the attack surface is negligible.
The main practical gotcha is understanding when you actually need it versus just using functools.wraps. For most modern Python code (3.7+), functools.wraps is sufficient unless you need the decorator module's specific signature manipulation features. The documentation could be clearer about this trade-off, and error messages when decorators are misapplied don't always point you to the root cause.
Best for: Projects requiring precise function signature preservation in decorators, especially when building frameworks or libraries that rely on introspection.
Avoid if: You're using Python 3.7+ and functools.wraps meets your needs, or you want to minimize even small third-party dependencies.
Sign in to write a review
Sign In