NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI
PyPI, #2992 most downloaded on PyPI
FastDepends - extracted and cleared from HTTP domain logic FastAPI Dependency Injection System. Async and sync are both supported.
Latest stable
3.0.11
Last release 7 days ago
15 Nov 2026
Release timing varies
gaps range from 8 days to 7 months
Most releases are documented
notes for 37 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
4 years old
83 releases · first in 2023
Drag across the ruler to compare, or tap a release to open it.
Second alpha release of FastDepends 4.0.
Second alpha release of FastDepends 4.0.
enc_hook and schema_hook options to MsgSpecSerializer, alongside the existing dec_hook.encode() overrides and raw root-byte passthrough.schema_hook to input and response JSON schemas, including dependency inputs, filtered fields and custom-field source groups. Native Struct metadata remains supported.field=True.use() hooks continue to run in the worker thread pool; concurrent field=True resolution and exception unwrapping are preserved.@inject continues to return validated Python values. JSON encoding remains an explicit operation.
Install this alpha explicitly:
pip install 'fast-depends[msgspec]==4.0.0a1'Full changelog: 4.0.0a0...4.0.0a1
Your coding agent can read these notes before it upgrades. Set up the MCP server →
First alpha release of FastDepends 4.0.
First alpha release of FastDepends 4.0.
pydantic>=2.12.5,<3. Projects using Pydantic 1 should remain on FastDepends 3.x.PydanticSerializer(...).encode(value) honor the instance's JSON encoding configuration. Existing integrations using this encoder now receive the configured output for ordinary values.call.serializer.get_schema(embed=False, exclude=(), resolve_refs=False) for external inputs, including dependency inputs, active provider overrides, aliases, and configuration.call.serializer.get_response_schema() for return-value JSON schemas.call.serializer.encode(value) for already validated handler results. With Pydantic, encoding uses the declared return type through TypeAdapter, including PlainSerializer, WrapSerializer, aliases, and model serialization. Direct model validation preserves custom model_validate() overrides.CustomField.get_schema(parameter) and SchemaField to describe external inputs and group them by source, such as headers or query parameters.Pydantic and Msgspec implement the schema API. Existing custom serializers can leave schema generation and encoding unimplemented until those methods are needed.
@inject continues to return validated Python values. Factory-level encode() remains a generic encoder; integrations select the serializer attached to a call to use that call's return annotation. Typed Pydantic encoding emits JSON even for root bytes, while the factory encoder continues to pass raw root bytes through. Msgspec retains its existing encoding behavior.
Pydantic remains optional. Msgspec and operation without either backend remain supported. Python 3.10+ is supported.
Install the alpha explicitly:
pip install 'fast-depends[pydantic]==4.0.0a0'Implemented in #318, incorporating #296, #297, #305, #306, #319, #320, and #321.
Full changelog: 3.0.11...4.0.0a0
fix: remove scope override when the block raises by @Wayfarer545 in #315
Full Changelog: 3.0.10...3.0.11
Add Python 3.15 support with Pydantic v2, msgspec, or no serializer by @Lancetnik in #312
Full Changelog: 3.0.9...3.0.10
fix: type inject(options) and run_async with a coroutine function by @Lancetnik in #299
inject(**options) and run_async with a coroutine function by @Lancetnik in #299Full Changelog: 3.0.8...3.0.9
chore: fix typos by @Lancetnik in #259
build(deps-dev): bump the pip group with 2 updates by @dependabot[bot] in https://github.com/Lancetnik/FastDepends/pull/257
Full Changelog: https://github.com/Lancetnik/FastDepends/compare/3.0.6...3.0.7
Full Changelog: 3.0.6...3.0.7
feat: add exclude option to schema generator by @Lancetnik in https://github.com/Lancetnik/FastDepends/pull/255
Full Changelog: https://github.com/Lancetnik/FastDepends/compare/3.0.5...3.0.6
Full Changelog: 3.0.5...3.0.6
ci: add free-threading tests by @Lancetnik in https://github.com/Lancetnik/FastDepends/pull/238
Full Changelog: https://github.com/Lancetnik/FastDepends/compare/3.0.4...3.0.5
Full Changelog: 3.0.4...3.0.5
Fix clear overrides by @redb0 in https://github.com/Lancetnik/FastDepends/pull/225
Full Changelog: https://github.com/Lancetnik/FastDepends/compare/3.0.3...3.0.4
Full Changelog: 3.0.3...3.0.4
chore: update relator by @Sehat1137 in https://github.com/Lancetnik/FastDepends/pull/221
Full Changelog: https://github.com/Lancetnik/FastDepends/compare/3.0.2...3.0.3
Full Changelog: 3.0.2...3.0.3
ci: install reagento/relator by @Sehat1137 in https://github.com/Lancetnik/FastDepends/pull/219
Full Changelog: https://github.com/Lancetnik/FastDepends/compare/3.0.1...3.0.2
Full Changelog: 3.0.1...3.0.2
fix: support provider[dep] = value override syntax by @Lancetnik in https://github.com/Lancetnik/FastDepends/pull/215
provider[dep] = value override syntax by @Lancetnik in https://github.com/Lancetnik/FastDepends/pull/215Full Changelog: https://github.com/Lancetnik/FastDepends/compare/3.0.0...3.0.1
provider[dep] = value override syntax by @Lancetnik in #215Full Changelog: 3.0.0...3.0.1
Currently you can select the serializer implementation you prefer
Currently you can select the serializer implementation you prefer
from pydantic import Field
from fast_depends import inject
from fast_depends.pydantic import PydanticSerializer
@inject(serializer=PydanticSerializer())
def func(a: list[int] = Field(min_length=1)): ...
from msgspec import field
from fast_depends import inject
from fast_depends.msgspec import MsgSpecSerializer
@inject(serializer_cls=MsgSpecSerializer())
def func(a: list[int] = field(default=[])) -> list[int]:
return a
build.py by @sobolevn in https://github.com/Lancetnik/FastDepends/pull/174Full Changelog: https://github.com/Lancetnik/FastDepends/compare/2.4.12...3.0.0
Currently you can select the serializer implementation you prefer
from pydantic import Field
from fast_depends import inject
from fast_depends.pydantic import PydanticSerializer
@inject(serializer=PydanticSerializer())
def func(a: list[int] = Field(min_length=1)): ...from msgspec import field
from fast_depends import inject
from fast_depends.msgspec import MsgSpecSerializer
@inject(serializer_cls=MsgSpecSerializer())
def func(a: list[int] = field(default=[])) -> list[int]:
return abuild.py by @sobolevn in #174Full Changelog: 2.4.12...3.0.0
Nothing published for this version
Currently you can select the serializer implementation you prefer
Currently you can select the serializer implementation you prefer
from pydantic import Field
from fast_depends import inject
from fast_depends.pydantic import PydanticSerializer
@inject(serializer=PydanticSerializer())
def func(a: list[int] = Field(min_length=1)): ...
from msgspec import field
from fast_depends import inject
from fast_depends.msgspec import MsgSpecSerializer
@inject(serializer_cls=MsgSpecSerializer())
def func(a: list[int] = field(default=[])) -> list[int]:
return a
build.py by @sobolevn in https://github.com/Lancetnik/FastDepends/pull/174Full Changelog: https://github.com/Lancetnik/FastDepends/compare/2.4.12...3.0.0rc0
Currently you can select the serializer implementation you prefer
from pydantic import Field
from fast_depends import inject
from fast_depends.pydantic import PydanticSerializer
@inject(serializer=PydanticSerializer())
def func(a: list[int] = Field(min_length=1)): ...from msgspec import field
from fast_depends import inject
from fast_depends.msgspec import MsgSpecSerializer
@inject(serializer_cls=MsgSpecSerializer())
def func(a: list[int] = field(default=[])) -> list[int]:
return abuild.py by @sobolevn in #174Full Changelog: 2.4.12...3.0.0rc0
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Add python 3.13 support by @Olegt0rr in https://github.com/Lancetnik/FastDepends/pull/140
Full Changelog: https://github.com/Lancetnik/FastDepends/compare/2.4.11...2.4.12
fix: Allow to use */ arguments with non-standard names by @Zhenay in https://github.com/Lancetnik/FastDepends/pull/127
*/** arguments with non-standard names by @Zhenay in https://github.com/Lancetnik/FastDepends/pull/127Full Changelog: https://github.com/Lancetnik/FastDepends/compare/2.4.10...2.4.11
fix: Allow to inject async functions into functions wrapped with asynccontextmanager by @Zhenay in https://github.com/Lancetnik/FastDepends/pull/125
Full Changelog: https://github.com/Lancetnik/FastDepends/compare/2.4.9...2.4.10
fix: Allow to inject async functions into async generators by @Zhenay in https://github.com/Lancetnik/FastDepends/pull/124
Full Changelog: https://github.com/Lancetnik/FastDepends/compare/2.4.8...2.4.9
feat: annotated_types with CustomField support by @Lancetnik in https://github.com/Lancetnik/FastDepends/pull/120
Full Changelog: https://github.com/Lancetnik/FastDepends/compare/2.4.7...2.4.8
fix bug #115 by @Cooh12 in https://github.com/Lancetnik/FastDepends/pull/117
Full Changelog: https://github.com/Lancetnik/FastDepends/compare/2.4.6...2.4.7
fix (#112): correct CustomFields mapping to positional args by @Lancetnik in https://github.com/Lancetnik/FastDepends/pull/113
Full Changelog: https://github.com/Lancetnik/FastDepends/compare/2.4.5...2.4.6
Now CustomField respects function default value at required=False case
Now CustomField respects function default value at required=False case
from typing_extensions import Annotated
from fast_depends import inject
from fast_depends.library import CustomField
@inject
def func(
a: Annotated[int, CustomField(cast=False, required=False)] = 1
):
assert a == 1 # `a` was `None` before
func()
Full Changelog: https://github.com/Lancetnik/FastDepends/compare/2.4.4...2.4.5
Use globals of original(wrapped) function by @yuyupopo in https://github.com/Lancetnik/FastDepends/pull/97
Annotated[..., CustomField()] reusageFull Changelog: https://github.com/Lancetnik/FastDepends/compare/2.4.3...2.4.4
fix: fix 4.12.0 typing extensions error with pydantic by @Lancetnik in https://github.com/Lancetnik/FastDepends/pull/93
Full Changelog: https://github.com/Lancetnik/FastDepends/compare/2.4.2...2.4.3
build(deps): bump dawidd6/action-download-artifact from 3.1.1 to 3.1.2 by @dependabot in https://github.com/Lancetnik/FastDepends/pull/74
Full Changelog: https://github.com/Lancetnik/FastDepends/compare/2.4.1...2.4.2
chore: remove optional dependencies, fix typos by @Lancetnik in https://github.com/Lancetnik/FastDepends/pull/73
Full Changelog: https://github.com/Lancetnik/FastDepends/compare/2.4.0...2.4.1
Add fast_depends.shema.get_schema method to generate wrapped function payload (close https://github.com/Lancetnik/FastDepends/issues/6)
fast_depends.shema.get_schema method to generate wrapped function payload (close https://github.com/Lancetnik/FastDepends/issues/6)ForwardRef resolutionFull Changelog: https://github.com/Lancetnik/FastDepends/compare/2.3.1...0.2.4
Nothing published for this version
Correct model.flat_params calculation
Correct model.flat_params calculation
Full Changelog: https://github.com/Lancetnik/FastDepends/compare/2.3.0...2.3.1
Multiple Annotated arguments support: ```python from typing import Annotated from annotated_types import Ge from pydantic.functional_validators import
Annotated arguments support:from typing import Annotated
from annotated_types import Ge
from pydantic.functional_validators import AfterValidator
@inject()
def f(a: Annotated[int, Ge(10), AfterValidator(lambda x: x + 10)]) -> int:
return a
assert f(10) == 20
@inject
def simple_func(a: str) -> Iterator[int]:
for _ in range(2):
yield a
for i in simple_func("1"):
assert i == 1
CustomField with async use_field in parallelFull Changelog: https://github.com/Lancetnik/FastDepends/compare/2.2.8...2.3.0
Restore fast_depends._compat.CreateBaseModel to save FastStream<0.3.7 compatibility
Restore fast_depends._compat.CreateBaseModel to save FastStream<0.3.7 compatibility
Full Changelog: https://github.com/Lancetnik/FastDepends/compare/2.2.7...2.2.8
bugfix: correct yield overriding by @Lancetnik in https://github.com/Lancetnik/FastDepends/pull/50 ```python from fast_depends import inject, Depends,
from fast_depends import inject, Depends, dependency_provider
def dep1():
yield 1
def dep2():
yield 2
@inject()
def func(d = Depends(dep1)):
return d
assert func() == 1
with dependency_provider.scope(dep1, dep2):
assert func() == 2
Full Changelog: https://github.com/Lancetnik/FastDepends/compare/2.2.6...2.2.7
Provides you with the ability to setup pydantic config using @inject
Provides you with the ability to setup pydantic config using @inject
@inject(pydantic_config={"str_max_length": 8})
def limited_str(a: str):
...
limited_str("*" * 9) # raises ValidationError
Also, added context manager method to override dependencies:
from fast_depends import Depends, dependency_provider, inject
def base_dep():
return 1
def override_dep():
return 2
@inject
def func(d=Depends(base_dep)):
return d
with dependency_provider.scope(base_dep, override_dep):
assert func() == 2
assert func() == 1
Full Changelog: https://github.com/Lancetnik/FastDepends/compare/2.2.5...2.2.6
New CustomField syntax to support classes injection:
New CustomField syntax to support classes injection:
class Header(CustomField):
def use(
self,
/, # <- new thing
**kwargs
):
kwargs = super().use(**kwargs)
kwargs[self.param_name] = kwargs["headers"][self.param_name]
return kwargs
Full Changelog: https://github.com/Lancetnik/FastDepends/compare/2.2.4...2.2.5
Now you can use FastDepends to inject dependencies to your class constructors and/or methods!
Now you can use FastDepends to inject dependencies to your class constructors and/or methods!
from fast_depends import Depends, inject
def get_var():
return 1
class Class:
@inject
def __init__(self, a = Depends(get_var)) -> None:
self.a = a
@inject
def calc(self, a = Depends(get_var)) -> int:
return a + self.a
assert Class().calc() == 2
Full Changelog: https://github.com/Lancetnik/FastDepends/compare/2.2.3...2.2.4
chore: downloads/month badge by @Lancetnik in https://github.com/Lancetnik/FastDepends/pull/14
Full Changelog: https://github.com/Lancetnik/FastDepends/compare/2.2.0...2.2.3
Nothing published for this version
Nothing published for this version
With this release, async and sync generator function support was added!
With this release, async and sync generator function support was added!
This case supports incoming and return types casting both
from fast_depends import inject
@inject
def func(a: str) -> int:
for _ in range(3)
yield a
for i in func(1):
assert i == "1"
Also, @inject has an option to disable pydantic validation with cast=False. This way Depends and your custom fields are still working, but pydantic is not even called.
from fast_depends import inject
@inject(cast=False)
def func(a: str) -> int:
return a
assert func(1.0) == 1.0
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
One column per quarter.