modern-di 0.13.0__py3-none-any.whl → 0.13.1__py3-none-any.whl
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.
Potentially problematic release.
This version of modern-di might be problematic. Click here for more details.
modern_di/container.py
CHANGED
|
@@ -119,16 +119,29 @@ class Container(contextlib.AbstractAsyncContextManager["Container"], contextlib.
|
|
|
119
119
|
else:
|
|
120
120
|
self._overrides.pop(provider_id, None)
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
def async_enter(self) -> "Container":
|
|
123
123
|
self._is_async = True
|
|
124
124
|
return self
|
|
125
125
|
|
|
126
|
+
def sync_enter(self) -> "Container":
|
|
127
|
+
self._is_async = False
|
|
128
|
+
return self
|
|
129
|
+
|
|
126
130
|
async def async_close(self) -> None:
|
|
127
131
|
self._check_entered()
|
|
128
132
|
for provider_state in reversed(self._provider_states.values()):
|
|
129
133
|
await provider_state.async_tear_down()
|
|
130
134
|
self._exit()
|
|
131
135
|
|
|
136
|
+
def sync_close(self) -> None:
|
|
137
|
+
self._check_entered()
|
|
138
|
+
for provider_state in reversed(self._provider_states.values()):
|
|
139
|
+
provider_state.sync_tear_down()
|
|
140
|
+
self._exit()
|
|
141
|
+
|
|
142
|
+
async def __aenter__(self) -> "Container":
|
|
143
|
+
return self.async_enter()
|
|
144
|
+
|
|
132
145
|
async def __aexit__(
|
|
133
146
|
self,
|
|
134
147
|
exc_type: type[BaseException] | None,
|
|
@@ -138,8 +151,7 @@ class Container(contextlib.AbstractAsyncContextManager["Container"], contextlib.
|
|
|
138
151
|
await self.async_close()
|
|
139
152
|
|
|
140
153
|
def __enter__(self) -> "Container":
|
|
141
|
-
self.
|
|
142
|
-
return self
|
|
154
|
+
return self.sync_enter()
|
|
143
155
|
|
|
144
156
|
def __exit__(
|
|
145
157
|
self,
|
|
@@ -147,7 +159,4 @@ class Container(contextlib.AbstractAsyncContextManager["Container"], contextlib.
|
|
|
147
159
|
exc_value: BaseException | None,
|
|
148
160
|
traceback: types.TracebackType | None,
|
|
149
161
|
) -> None:
|
|
150
|
-
self.
|
|
151
|
-
for provider_state in reversed(self._provider_states.values()):
|
|
152
|
-
provider_state.sync_tear_down()
|
|
153
|
-
self._exit()
|
|
162
|
+
self.sync_close()
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: modern-di
|
|
3
|
+
Version: 0.13.1
|
|
4
|
+
Summary: Dependency Injection framework with IOC-container and scopes
|
|
5
|
+
Project-URL: repository, https://github.com/modern-python/modern-di
|
|
6
|
+
Project-URL: docs, https://modern-di.readthedocs.io
|
|
7
|
+
Author-email: Artur Shiriev <me@shiriev.ru>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
Keywords: DI,dependency injector,ioc-container,mocks,python
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
15
|
+
Classifier: Typing :: Typed
|
|
16
|
+
Requires-Python: <4,>=3.10
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
"Modern-DI"
|
|
20
|
+
==
|
|
21
|
+
|
|
22
|
+
| Project | Badges |
|
|
23
|
+
|----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
24
|
+
| common | [](https://mypy.readthedocs.io/en/stable/getting_started.html#strict-mode-and-configuration) [](https://github.com/modern-python/modern-di/stargazers) |
|
|
25
|
+
| modern-di | [](https://pypi.python.org/pypi/modern-di ) [](https://pypistats.org/packages/modern-di) |
|
|
26
|
+
| modern-di-fastapi | [](https://pypi.python.org/pypi/modern-di-fastapi) [](https://pypistats.org/packages/modern-di-fastapi) |
|
|
27
|
+
| modern-di-faststream | [](https://pypi.python.org/pypi/modern-di-faststream) [](https://pypistats.org/packages/modern-di-faststream) |
|
|
28
|
+
| modern-di-litestar | [](https://pypi.python.org/pypi/modern-di-litestar) [](https://pypistats.org/packages/modern-di-litestar) |
|
|
29
|
+
|
|
30
|
+
`modern-di` is a python dependency injection framework which, among other things,
|
|
31
|
+
supports the following:
|
|
32
|
+
|
|
33
|
+
- Async and sync dependency resolution
|
|
34
|
+
- Scopes and granular context management
|
|
35
|
+
- Python 3.10+ support
|
|
36
|
+
- Fully typed and tested
|
|
37
|
+
- Integrations with `FastAPI`, `FastStream` and `LiteStar`
|
|
38
|
+
|
|
39
|
+
## 📚 [Documentation](https://modern-di.readthedocs.io)
|
|
40
|
+
|
|
41
|
+
## 📦 [PyPi](https://pypi.org/project/modern-di)
|
|
42
|
+
|
|
43
|
+
## 📝 [License](LICENSE)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
modern_di/__init__.py,sha256=L01VkzSJiV0d0FPrh1DZ-Wy5mUmoG6X-oLz7xYxtehI,194
|
|
2
|
-
modern_di/container.py,sha256=
|
|
2
|
+
modern_di/container.py,sha256=x3DBSaEha4ny0Nbs2UmUyLF4xc5hWOyYsV7bfq_LKtw,5236
|
|
3
3
|
modern_di/graph.py,sha256=X60wtG3Mqus_5YZNiZlQuXoHODBp7rYl_IHJs7GzSQM,1356
|
|
4
4
|
modern_di/provider_state.py,sha256=oU08QnMr0yhIZKkz0Pee8_RnWtETDE9ux4JB83qhwTI,1358
|
|
5
5
|
modern_di/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -18,6 +18,6 @@ modern_di/providers/object.py,sha256=Sm0mb3Ua7cZ5Ay65fLvl7fnJDSQrQZwvzio3lkkXP2A
|
|
|
18
18
|
modern_di/providers/resource.py,sha256=Vp8psY_svOQEJ_38DWhR8ASYpqhP9DoB7bC0jH0IlaU,4605
|
|
19
19
|
modern_di/providers/selector.py,sha256=RQbHD2-Liw-TGqu6UELbfCzXYuqxiO_Mg1tLyF3mKQo,1419
|
|
20
20
|
modern_di/providers/singleton.py,sha256=_hUpCmbHgLAigdhBiu0zypwWwrIGdB6_oZkGfuLxzNE,2372
|
|
21
|
-
modern_di-0.13.
|
|
22
|
-
modern_di-0.13.
|
|
23
|
-
modern_di-0.13.
|
|
21
|
+
modern_di-0.13.1.dist-info/METADATA,sha256=ImXY4815mlD-RGWMbA-ZQ_bca2TtUnpv43b8XtO8ex8,3382
|
|
22
|
+
modern_di-0.13.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
23
|
+
modern_di-0.13.1.dist-info/RECORD,,
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: modern-di
|
|
3
|
-
Version: 0.13.0
|
|
4
|
-
Summary: Dependency Injection framework with IOC-container and scopes
|
|
5
|
-
Project-URL: repository, https://github.com/modern-python/modern-di
|
|
6
|
-
Project-URL: docs, https://modern-di.readthedocs.io
|
|
7
|
-
Author-email: Artur Shiriev <me@shiriev.ru>
|
|
8
|
-
License-Expression: MIT
|
|
9
|
-
Keywords: DI,dependency injector,ioc-container,mocks,python
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
-
Classifier: Topic :: Software Development :: Libraries
|
|
15
|
-
Classifier: Typing :: Typed
|
|
16
|
-
Requires-Python: <4,>=3.10
|
|
17
|
-
Description-Content-Type: text/markdown
|
|
18
|
-
|
|
19
|
-
"Modern-DI"
|
|
20
|
-
==
|
|
21
|
-
|
|
22
|
-
| Project | Badges |
|
|
23
|
-
|--------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
24
|
-
| common | [](https://mypy.readthedocs.io/en/stable/getting_started.html#strict-mode-and-configuration) [](https://github.com/modern-python/modern-di/stargazers) |
|
|
25
|
-
| modern-di | [](https://pypi.python.org/pypi/modern-di ) [](https://pypistats.org/packages/modern-di) |
|
|
26
|
-
| modern-di-fastapi | [](https://pypi.python.org/pypi/modern-di-fastapi) [](https://pypistats.org/packages/modern-di-fastapi) |
|
|
27
|
-
| modern-di-litestar | [](https://pypi.python.org/pypi/modern-di-litestar) [](https://pypistats.org/packages/modern-di-litestar) |
|
|
28
|
-
|
|
29
|
-
`modern-di` is a python dependency injection framework which, among other things,
|
|
30
|
-
supports the following:
|
|
31
|
-
|
|
32
|
-
- Async and sync dependency resolution
|
|
33
|
-
- Scopes and granular context management
|
|
34
|
-
- Python 3.10+ support
|
|
35
|
-
- Fully typed and tested
|
|
36
|
-
- Compatibility with popular frameworks like `FastAPI` and `LiteStar`
|
|
37
|
-
- Thread-safe and asyncio concurrency safe providers
|
|
38
|
-
|
|
39
|
-
## 📚 [Documentation](https://modern-di.readthedocs.io)
|
|
40
|
-
|
|
41
|
-
## 📦 [PyPi](https://pypi.org/project/modern-di)
|
|
42
|
-
|
|
43
|
-
## 📝 [License](LICENSE)
|
|
File without changes
|