diff --git a/src/dishka/dependency_source/make_alias.py b/src/dishka/dependency_source/make_alias.py index 68315b0f..053d5766 100644 --- a/src/dishka/dependency_source/make_alias.py +++ b/src/dishka/dependency_source/make_alias.py @@ -8,8 +8,8 @@ def alias( - *, source: Any, + *, provides: Any | None = None, cache: bool = True, component: Component | None = None, diff --git a/src/dishka/provider.py b/src/dishka/provider.py index 2b9618f3..d9db3979 100644 --- a/src/dishka/provider.py +++ b/src/dishka/provider.py @@ -171,8 +171,8 @@ def provide_all( def alias( self, - *, source: type, + *, provides: Any = None, cache: bool = True, component: Component | None = None, @@ -203,9 +203,15 @@ def to_component(self, component: Component) -> ProviderWrapper: return ProviderWrapper(component, self) def from_context( - self, *, provides: Any, scope: BaseScope, + self, + provides: Any, + *, + scope: BaseScope | None = None, ) -> CompositeDependencySource: - composite = from_context(provides, scope=scope) + composite = from_context( + provides=provides, + scope=scope or self.scope, + ) self._add_dependency_sources( name=str(provides), sources=composite.dependency_sources,