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