fastapi-decorators
Create decorators for your endpoints using FastAPI dependencies.
Decision gist · record as of 2026-08-14
Yes. The package solves a genuine friction point in FastAPI: building reusable decorators that need access to dependencies. It has no security vulnerabilities, low install friction, permissive licensing, and active maintenance. Use it when you find yourself writing the same dependency-aware decorator logic across multiple endpoints.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction: pure Python wheel with a single runtime dependency on fastapi.
- Actively maintained with recent commits and a stable beta status.
License · maintenance · safety
permissive license (permissive) — MIT license permits unrestricted use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
last release 2026-03-30 (137 days) · last repo commit 2026-03-30 · 83 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 148,668 downloads/mo, #11,023 on PyPI
Alternatives
Verify before relying
from fastapi import FastAPI, Depends, HTTPException
from fastapi_decorators import depends
@depends
def require_auth(token: str = Depends(lambda: "token")):
if not token:
raise HTTPException(status_code=401)
app = FastAPI()
@app.get("/items")
@require_auth
def get_items():
return {"items": []}- Whether the package handles async endpoint functions and async dependencies correctly in all decorator patterns.
- Performance overhead of the @depends decorator wrapper compared to direct FastAPI Depends() usage at scale.
What it is and what it does
fastapi-decorators provides a @depends decorator that wraps FastAPI's Depends() mechanism, letting you build reusable decorators that inject dependencies into endpoints without repeating dependency resolution logic. Instead of manually threading FastAPI dependencies through custom decorators, you annotate a function with @depends and use it directly as a decorator on your route handlers.
The package supports three main patterns: simple decorators that run side effects (logging, auditing), decorator factories that accept parameters (rate limiting, authorization scopes), and wrapper decorators that intercept endpoint execution while still accessing injected dependencies (caching, error handling). It integrates directly with FastAPI's dependency system, so decorated endpoints appear correctly in auto-generated API documentation.
Use it for
- Build an authentication decorator that checks OAuth2 tokens and raises 401/403 errors without duplicating token resolution logic across routes.
- Create a rate-limiting decorator factory that accepts max_calls and period parameters and applies them to individual endpoints.
- Implement a caching decorator that wraps expensive operations and uses a Depends()-injected cache backend to store and retrieve results.
- Add request logging or audit trails by decorating endpoints to capture request metadata and write to a database via injected Session.
- Enforce custom response headers or modify responses by decorating endpoints with a decorator that receives the Response object via Depends().
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package solves a genuine friction point in FastAPI: building reusable decorators that need access to dependencies. It has no security vulnerabilities, low install friction, permissive licensing, and active maintenance. Use it when you find yourself writing the same dependency-aware decorator logic across multiple endpoints.
Install
fastapi-decorators on PyPI
Before you install
Low friction: pure Python wheel with a single runtime dependency on fastapi. Actively maintained with recent commits and a stable beta status.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
Quickstart
from fastapi import FastAPI, Depends, HTTPException
from fastapi_decorators import depends
@depends
def require_auth(token: str = Depends(lambda: "token")):
if not token:
raise HTTPException(status_code=401)
app = FastAPI()
@app.get("/items")
@require_auth
def get_items():
return {"items": []}
Verify before relying
- Whether the package handles async endpoint functions and async dependencies correctly in all decorator patterns.
- Performance overhead of the @depends decorator wrapper compared to direct FastAPI Depends() usage at scale.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagefastapi |
| Maintenance | Actively maintained 137 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 148,668 / month, #11,023 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaEnvironment :: Web EnvironmentFramework :: FastAPIIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: InternetTopic :: Internet :: WWW/HTTPTopic :: Internet :: WWW/HTTP :: HTTP ServersTopic :: Software DevelopmentTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Application FrameworksTopic :: Software Development :: Libraries :: Python ModulesTyping :: Typed |
Evidence: fastapi_decorators-1.0.20-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 › “fastapi decorator with dependencies”
- fastapi-decoratorsConverts functions into FastAPI-compatible decorators that can inject…
- fastapi-injectableEnables FastAPI's Depends() dependency injection system to work…
- fastapi-versioningAdds API versioning to FastAPI applications by decorating endpoints…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also fast-depends · fastapi-injectable · fastapi-versioning · fastapi-cache2 · decorator · fastapi-limiter · uncalled-for · essentials · slowapi · fan-tools