modern-di 0.12.0__tar.gz → 0.13.1__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.
Potentially problematic release.
This version of modern-di might be problematic. Click here for more details.
- modern_di-0.13.1/PKG-INFO +43 -0
- {modern_di-0.12.0 → modern_di-0.13.1}/modern_di/container.py +23 -11
- modern_di-0.12.0/PKG-INFO +0 -41
- {modern_di-0.12.0 → modern_di-0.13.1}/.gitignore +0 -0
- {modern_di-0.12.0 → modern_di-0.13.1}/modern_di/__init__.py +0 -0
- {modern_di-0.12.0 → modern_di-0.13.1}/modern_di/graph.py +0 -0
- {modern_di-0.12.0 → modern_di-0.13.1}/modern_di/helpers/__init__.py +0 -0
- {modern_di-0.12.0 → modern_di-0.13.1}/modern_di/helpers/attr_getter_helpers.py +0 -0
- {modern_di-0.12.0 → modern_di-0.13.1}/modern_di/provider_state.py +0 -0
- {modern_di-0.12.0 → modern_di-0.13.1}/modern_di/providers/__init__.py +0 -0
- {modern_di-0.12.0 → modern_di-0.13.1}/modern_di/providers/abstract.py +0 -0
- {modern_di-0.12.0 → modern_di-0.13.1}/modern_di/providers/container_provider.py +0 -0
- {modern_di-0.12.0 → modern_di-0.13.1}/modern_di/providers/context_adapter.py +0 -0
- {modern_di-0.12.0 → modern_di-0.13.1}/modern_di/providers/dict.py +0 -0
- {modern_di-0.12.0 → modern_di-0.13.1}/modern_di/providers/factory.py +0 -0
- {modern_di-0.12.0 → modern_di-0.13.1}/modern_di/providers/injected_factory.py +0 -0
- {modern_di-0.12.0 → modern_di-0.13.1}/modern_di/providers/list.py +0 -0
- {modern_di-0.12.0 → modern_di-0.13.1}/modern_di/providers/object.py +0 -0
- {modern_di-0.12.0 → modern_di-0.13.1}/modern_di/providers/resource.py +0 -0
- {modern_di-0.12.0 → modern_di-0.13.1}/modern_di/providers/selector.py +0 -0
- {modern_di-0.12.0 → modern_di-0.13.1}/modern_di/providers/singleton.py +0 -0
- {modern_di-0.12.0 → modern_di-0.13.1}/modern_di/py.typed +0 -0
- {modern_di-0.12.0 → modern_di-0.13.1}/modern_di/scope.py +0 -0
- {modern_di-0.12.0 → modern_di-0.13.1}/pyproject.toml +0 -0
|
@@ -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)
|
|
@@ -119,24 +119,39 @@ 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
|
+
|
|
130
|
+
async def async_close(self) -> None:
|
|
131
|
+
self._check_entered()
|
|
132
|
+
for provider_state in reversed(self._provider_states.values()):
|
|
133
|
+
await provider_state.async_tear_down()
|
|
134
|
+
self._exit()
|
|
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
|
+
|
|
126
145
|
async def __aexit__(
|
|
127
146
|
self,
|
|
128
147
|
exc_type: type[BaseException] | None,
|
|
129
148
|
exc_val: BaseException | None,
|
|
130
149
|
traceback: types.TracebackType | None,
|
|
131
150
|
) -> None:
|
|
132
|
-
self.
|
|
133
|
-
for provider_state in reversed(self._provider_states.values()):
|
|
134
|
-
await provider_state.async_tear_down()
|
|
135
|
-
self._exit()
|
|
151
|
+
await self.async_close()
|
|
136
152
|
|
|
137
153
|
def __enter__(self) -> "Container":
|
|
138
|
-
self.
|
|
139
|
-
return self
|
|
154
|
+
return self.sync_enter()
|
|
140
155
|
|
|
141
156
|
def __exit__(
|
|
142
157
|
self,
|
|
@@ -144,7 +159,4 @@ class Container(contextlib.AbstractAsyncContextManager["Container"], contextlib.
|
|
|
144
159
|
exc_value: BaseException | None,
|
|
145
160
|
traceback: types.TracebackType | None,
|
|
146
161
|
) -> None:
|
|
147
|
-
self.
|
|
148
|
-
for provider_state in reversed(self._provider_states.values()):
|
|
149
|
-
provider_state.sync_tear_down()
|
|
150
|
-
self._exit()
|
|
162
|
+
self.sync_close()
|
modern_di-0.12.0/PKG-INFO
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: modern-di
|
|
3
|
-
Version: 0.12.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
|
-
Dependency injection framework for Python inspired by `dependency-injector` and `dishka`.
|
|
30
|
-
|
|
31
|
-
It is in development state yet and gives you the following:
|
|
32
|
-
- DI framework with IOC-container and scopes.
|
|
33
|
-
- Async and sync resolving.
|
|
34
|
-
- Python 3.10-3.13 support.
|
|
35
|
-
- Full coverage by types annotations (mypy in strict mode).
|
|
36
|
-
- Overriding dependencies for tests.
|
|
37
|
-
- Package with zero dependencies.
|
|
38
|
-
- Integration with FastAPI and LiteStar
|
|
39
|
-
- Thread-safe and asyncio concurrency safe providers
|
|
40
|
-
|
|
41
|
-
📚 [Documentation](https://modern-di.readthedocs.io)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|