modern-di 0.8.0__py3-none-any.whl → 0.9.0__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 +5 -5
- modern_di/provider_state.py +1 -1
- modern_di/providers/__init__.py +2 -2
- modern_di/providers/abstract.py +2 -2
- {modern_di-0.8.0.dist-info → modern_di-0.9.0.dist-info}/METADATA +2 -1
- {modern_di-0.8.0.dist-info → modern_di-0.9.0.dist-info}/RECORD +7 -7
- {modern_di-0.8.0.dist-info → modern_di-0.9.0.dist-info}/WHEEL +0 -0
modern_di/container.py
CHANGED
|
@@ -15,13 +15,13 @@ T_co = typing.TypeVar("T_co", covariant=True)
|
|
|
15
15
|
|
|
16
16
|
class Container(contextlib.AbstractAsyncContextManager["Container"]):
|
|
17
17
|
__slots__ = (
|
|
18
|
-
"scope",
|
|
19
|
-
"parent_container",
|
|
20
|
-
"context",
|
|
21
18
|
"_is_async",
|
|
22
|
-
"_provider_states",
|
|
23
19
|
"_overrides",
|
|
20
|
+
"_provider_states",
|
|
24
21
|
"_use_threading_lock",
|
|
22
|
+
"context",
|
|
23
|
+
"parent_container",
|
|
24
|
+
"scope",
|
|
25
25
|
)
|
|
26
26
|
|
|
27
27
|
def __init__(
|
|
@@ -37,7 +37,7 @@ class Container(contextlib.AbstractAsyncContextManager["Container"]):
|
|
|
37
37
|
self.context: dict[str, typing.Any] = context or {}
|
|
38
38
|
self._is_async: bool | None = None
|
|
39
39
|
self._provider_states: dict[str, ProviderState[typing.Any]] = {}
|
|
40
|
-
self._overrides: dict[str, typing.Any] = {}
|
|
40
|
+
self._overrides: dict[str, typing.Any] = parent_container._overrides if parent_container else {} # noqa: SLF001
|
|
41
41
|
self._use_threading_lock = use_threading_lock
|
|
42
42
|
|
|
43
43
|
def _exit(self) -> None:
|
modern_di/provider_state.py
CHANGED
|
@@ -8,7 +8,7 @@ T_co = typing.TypeVar("T_co", covariant=True)
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class ProviderState(typing.Generic[T_co]):
|
|
11
|
-
__slots__ = "
|
|
11
|
+
__slots__ = "asyncio_lock", "context_stack", "instance", "threading_lock"
|
|
12
12
|
|
|
13
13
|
def __init__(self, use_asyncio_lock: bool, use_threading_lock: bool) -> None:
|
|
14
14
|
self.context_stack: contextlib.AsyncExitStack | contextlib.ExitStack | None = None
|
modern_di/providers/__init__.py
CHANGED
modern_di/providers/abstract.py
CHANGED
|
@@ -39,10 +39,10 @@ class AbstractProvider(typing.Generic[T_co], abc.ABC):
|
|
|
39
39
|
|
|
40
40
|
class AbstractOverrideProvider(AbstractProvider[T_co], abc.ABC):
|
|
41
41
|
def override(self, override_object: object, container: Container) -> None:
|
|
42
|
-
container.
|
|
42
|
+
container.override(self.provider_id, override_object)
|
|
43
43
|
|
|
44
44
|
def reset_override(self, container: Container) -> None:
|
|
45
|
-
container.
|
|
45
|
+
container.reset_override(self.provider_id)
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
class AbstractCreatorProvider(AbstractOverrideProvider[T_co], abc.ABC):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: modern-di
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.0
|
|
4
4
|
Summary: Dependency Injection framework with IOC-container and scopes
|
|
5
5
|
Project-URL: repository, https://github.com/modern-python/modern-di
|
|
6
6
|
Project-URL: docs, https://modern-di.readthedocs.io
|
|
@@ -36,6 +36,7 @@ It is in development state yet and gives you the following:
|
|
|
36
36
|
- Overriding dependencies for tests.
|
|
37
37
|
- Package with zero dependencies.
|
|
38
38
|
- Integration with FastAPI and LiteStar
|
|
39
|
+
- Thread-safe and asyncio concurrency safe providers
|
|
39
40
|
|
|
40
41
|
📚 [Documentation](https://modern-di.readthedocs.io)
|
|
41
42
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
modern_di/__init__.py,sha256=L01VkzSJiV0d0FPrh1DZ-Wy5mUmoG6X-oLz7xYxtehI,194
|
|
2
|
-
modern_di/container.py,sha256=
|
|
2
|
+
modern_di/container.py,sha256=a9NB7P4OQ92seGGztu9SGBChmv79nJ9kHxeF8V2zwpg,4900
|
|
3
3
|
modern_di/graph.py,sha256=X60wtG3Mqus_5YZNiZlQuXoHODBp7rYl_IHJs7GzSQM,1356
|
|
4
|
-
modern_di/provider_state.py,sha256=
|
|
4
|
+
modern_di/provider_state.py,sha256=oU08QnMr0yhIZKkz0Pee8_RnWtETDE9ux4JB83qhwTI,1358
|
|
5
5
|
modern_di/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
modern_di/scope.py,sha256=e6Olc-CF89clbYDNGciy-F8EqJt1Mw2703zfuJaEY94,113
|
|
7
|
-
modern_di/providers/__init__.py,sha256=
|
|
8
|
-
modern_di/providers/abstract.py,sha256=
|
|
7
|
+
modern_di/providers/__init__.py,sha256=tnF38UC-INW1GPPsGlj5tLqGi6fMfHodpi91wHDW-jY,649
|
|
8
|
+
modern_di/providers/abstract.py,sha256=UMj4CRn-JfGZfiveWFTkH7V92h4UXS4eYf8noZqPWGQ,3107
|
|
9
9
|
modern_di/providers/container_provider.py,sha256=r5IEQXgKtPwvHvbqkbPnmGyDGGCCjokTtdard9Rvt40,548
|
|
10
10
|
modern_di/providers/context_adapter.py,sha256=_b1x3ToQPWT-9KkDioFhw1W8Q1VXZYUnczfYzMTobVA,760
|
|
11
11
|
modern_di/providers/dict.py,sha256=nCU9iaqteYHDbILAfhrdnbMgS9_emE4MS7Xn2VoUlPo,858
|
|
@@ -15,6 +15,6 @@ modern_di/providers/list.py,sha256=3hx34RfBRmqzh-cT5D6wSTDJPkBGMK_ul4n9gQz-o9M,7
|
|
|
15
15
|
modern_di/providers/resource.py,sha256=CsMekkVISklTqN539XqH4iE80vfc6sQMav5OT8fZvyA,4591
|
|
16
16
|
modern_di/providers/selector.py,sha256=RQbHD2-Liw-TGqu6UELbfCzXYuqxiO_Mg1tLyF3mKQo,1419
|
|
17
17
|
modern_di/providers/singleton.py,sha256=_hUpCmbHgLAigdhBiu0zypwWwrIGdB6_oZkGfuLxzNE,2372
|
|
18
|
-
modern_di-0.
|
|
19
|
-
modern_di-0.
|
|
20
|
-
modern_di-0.
|
|
18
|
+
modern_di-0.9.0.dist-info/METADATA,sha256=jmn_QkeNOtjU_z1raF5FECSDkaLMhBkTXjb8SEqT7Hc,5493
|
|
19
|
+
modern_di-0.9.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
20
|
+
modern_di-0.9.0.dist-info/RECORD,,
|
|
File without changes
|