This repository was archived by the owner on Aug 10, 2024. It is now read-only.
V1.3.0
Deprecation
@serviceis deprecated in favor of@injectablewhich is a drop-in replacement.@injectused to raise aRuntimeErrorwhen specifyingignore_type_hints=Trueand no injections were found. It now raisesNoInjectionsFoundErrorWiring.wireused to return the wired class, it won't be the case anymore.
Features
-
Add local type hint support with
type_hints_localsargument for@inject,@injectable,@implementsand@wireThe default behavior can be configured globally withconfigAuto-detection is done throughinspectand frame manipulation. It's mostly helpful inside tests.from __future__ import annotations from antidote import config, inject, injectable, world def function() -> None: @injectable class Dummy: pass @inject(type_hints_locals='auto') def f(dummy: Dummy = inject.me()) -> Dummy: return dummy assert f() is world.get(Dummy) function() config.auto_detect_type_hints_locals = True def function2() -> None: @injectable class Dummy: pass @inject def f(dummy: Dummy = inject.me()) -> Dummy: return dummy assert f() is world.get(Dummy) function2()
-
Add
factory_methodto@injectable(previous@service)from __future__ import annotations from antidote import injectable @injectable(factory_method='build') class Dummy: @classmethod def build(cls) -> Dummy: return cls()
-
Added
ignore_type_hintsargument toWiringand@wire -
Added
type_hints_localsandclass_in_localnsargument toWiring.wire
Bug fix
- Fix
Optionaldetection in predicate constraints.