Releases: Lancetnik/FastDepends
2.2.4
What's Changed
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
- build(deps-dev): bump ruff from 0.1.5 to 0.1.6 by @dependabot in #28
- build(deps-dev): bump mypy from 1.7.0 to 1.7.1 by @dependabot in #29
- build(deps): bump pypa/gh-action-pypi-publish from 1.8.10 to 1.8.11 by @dependabot in #30
- build(deps-dev): bump ruff from 0.1.6 to 0.1.7 by @dependabot in #33
- build(deps-dev): bump isort from 5.12.0 to 5.13.0 by @dependabot in #32
- build(deps): bump actions/setup-python from 4 to 5 by @dependabot in #31
- feat (#34): inject to classes by @Lancetnik in #35
Full Changelog: 2.2.3...2.2.4
2.2.3
What's Changed
- chore: downloads/month badge by @Lancetnik in #14
- build(deps): bump actions/cache from 2 to 3 by @dependabot in #18
- build(deps): bump dawidd6/action-download-artifact from 2.26.0 to 2.28.0 by @dependabot in #17
- build(deps): bump pypa/gh-action-pypi-publish from 1.6.4 to 1.8.10 by @dependabot in #16
- build(deps): bump actions/checkout from 3 to 4 by @dependabot in #15
- chore: remove service from tests CI by @Lancetnik in #20
- chore: stable python3.12 by @Lancetnik in #21
- chore: change name in CI by @Lancetnik in #22
- chore: change PYPI publish trigger by @Lancetnik in #23
- build(deps-dev): bump ruff from 0.1.4 to 0.1.5 by @dependabot in #25
- build(deps-dev): bump mypy from 1.6.1 to 1.7.0 by @dependabot in #24
- fix (#26): respect original call locals by @Lancetnik in #27
New Contributors
- @Lancetnik made their first contribution in #14
- @dependabot made their first contribution in #18
Full Changelog: 2.2.0...2.2.3
2.2.0 (2023-09-22) Generators support
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
2.1.0 (2023-07-17) Args and Kwargs supporting
Now the package is able to validate not only a final decraled fields, but also an *args, **kwargs
too!
@inject
def simple_func(
a: int,
*args: Tuple[float, ...],
b: int,
**kwargs: Dict[str, int],
):
...
This way, the all function variaty is supported
2.0.1 (2023-06-21) PydanticV2 stable
Stable and fulltested PydanticV2 and PydanticV1 both supporting!
2.0.0b (2023-06-19) PydanticV2
It is a totally new package with the same testcases and public interfaces!
It works with pydanticV1
and pydanticV2.0b3
both, so you can easy migrate to beta pydanticV2 Rust
version and increase performance by 2-50x!
1.1.0 (2023-04-18)
Custom Field is here!
Now you are able to create your own Header, Path, BackgroundTasks or anything you wish fields with a custom behavior.
Take a look at the docs for details.
(2023-04-16) INITIAL
Inial release
Includes:
Depends
class with nesting- incoming and returning arguments type casting
- async and sync code supporting
Release is 100% tested, all actual by 0.95.0 FastAPI version features are supported.
Just download and enjoy this package.
Full Changelog: https://github.com/Lancetnik/FastDepends/commits/1.0.0