modern-di-litestar 2.4.0__tar.gz → 2.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: modern-di-litestar
3
- Version: 2.4.0
3
+ Version: 2.5.0
4
4
  Summary: Modern-DI integration for LiteStar
5
5
  Project-URL: repository, https://github.com/modern-python/modern-di
6
6
  Project-URL: docs, https://modern-di.readthedocs.io
@@ -0,0 +1,16 @@
1
+ from modern_di_litestar.main import (
2
+ FromDI,
3
+ ModernDIPlugin,
4
+ fetch_di_container,
5
+ litestar_request_provider,
6
+ litestar_websocket_provider,
7
+ )
8
+
9
+
10
+ __all__ = [
11
+ "FromDI",
12
+ "ModernDIPlugin",
13
+ "fetch_di_container",
14
+ "litestar_request_provider",
15
+ "litestar_websocket_provider",
16
+ ]
@@ -15,8 +15,8 @@ from modern_di.scope import Scope as DIScope
15
15
  T_co = typing.TypeVar("T_co", covariant=True)
16
16
 
17
17
 
18
- litestar_request = providers.ContextProvider(scope=Scope.REQUEST, context_type=litestar.Request)
19
- litestar_websocket = providers.ContextProvider(scope=Scope.SESSION, context_type=litestar.WebSocket)
18
+ litestar_request_provider = providers.ContextProvider(scope=Scope.REQUEST, context_type=litestar.Request)
19
+ litestar_websocket_provider = providers.ContextProvider(scope=Scope.SESSION, context_type=litestar.WebSocket)
20
20
 
21
21
 
22
22
  def fetch_di_container(app_: litestar.Litestar) -> Container:
@@ -39,9 +39,7 @@ class ModernDIPlugin(InitPlugin):
39
39
  self.container = container
40
40
 
41
41
  def on_app_init(self, app_config: AppConfig) -> AppConfig:
42
- self.container.providers_registry.add_providers(
43
- litestar_request=litestar_request, litestar_websocket=litestar_websocket
44
- )
42
+ self.container.providers_registry.add_providers(litestar_request_provider, litestar_websocket_provider)
45
43
  app_config.state.di_container = self.container
46
44
  app_config.dependencies["di_container"] = Provide(build_di_container)
47
45
  app_config.lifespan.append(_lifespan_manager)
@@ -16,7 +16,7 @@ classifiers = [
16
16
  "Topic :: Software Development :: Libraries",
17
17
  ]
18
18
  dependencies = ["litestar", "modern-di>=2"]
19
- version = "2.4.0"
19
+ version = "2.5.0"
20
20
 
21
21
  [project.urls]
22
22
  repository = "https://github.com/modern-python/modern-di"
@@ -1,8 +0,0 @@
1
- from modern_di_litestar.main import FromDI, ModernDIPlugin, fetch_di_container
2
-
3
-
4
- __all__ = [
5
- "FromDI",
6
- "ModernDIPlugin",
7
- "fetch_di_container",
8
- ]