modern-di 0.6.0__tar.gz → 0.7.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.
Potentially problematic release.
This version of modern-di might be problematic. Click here for more details.
- {modern_di-0.6.0 → modern_di-0.7.0}/PKG-INFO +4 -2
- {modern_di-0.6.0 → modern_di-0.7.0}/modern_di/providers/__init__.py +2 -0
- modern_di-0.7.0/modern_di/providers/container_provider.py +19 -0
- {modern_di-0.6.0 → modern_di-0.7.0}/.gitignore +0 -0
- {modern_di-0.6.0 → modern_di-0.7.0}/modern_di/__init__.py +0 -0
- {modern_di-0.6.0 → modern_di-0.7.0}/modern_di/container.py +0 -0
- {modern_di-0.6.0 → modern_di-0.7.0}/modern_di/graph.py +0 -0
- {modern_di-0.6.0 → modern_di-0.7.0}/modern_di/provider_state.py +0 -0
- {modern_di-0.6.0 → modern_di-0.7.0}/modern_di/providers/abstract.py +0 -0
- {modern_di-0.6.0 → modern_di-0.7.0}/modern_di/providers/context_adapter.py +0 -0
- {modern_di-0.6.0 → modern_di-0.7.0}/modern_di/providers/dict.py +0 -0
- {modern_di-0.6.0 → modern_di-0.7.0}/modern_di/providers/factory.py +0 -0
- {modern_di-0.6.0 → modern_di-0.7.0}/modern_di/providers/injected_factory.py +0 -0
- {modern_di-0.6.0 → modern_di-0.7.0}/modern_di/providers/list.py +0 -0
- {modern_di-0.6.0 → modern_di-0.7.0}/modern_di/providers/resource.py +0 -0
- {modern_di-0.6.0 → modern_di-0.7.0}/modern_di/providers/selector.py +0 -0
- {modern_di-0.6.0 → modern_di-0.7.0}/modern_di/providers/singleton.py +0 -0
- {modern_di-0.6.0 → modern_di-0.7.0}/modern_di/py.typed +0 -0
- {modern_di-0.6.0 → modern_di-0.7.0}/modern_di/scope.py +0 -0
- {modern_di-0.6.0 → modern_di-0.7.0}/pyproject.toml +0 -0
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: modern-di
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.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
|
|
7
7
|
Author-email: Artur Shiriev <me@shiriev.ru>
|
|
8
|
+
License: MIT
|
|
8
9
|
Keywords: DI,dependency injector,ioc-container,mocks,python
|
|
9
10
|
Classifier: Programming Language :: Python :: 3.10
|
|
10
11
|
Classifier: Programming Language :: Python :: 3.11
|
|
@@ -27,13 +28,14 @@ Description-Content-Type: text/markdown
|
|
|
27
28
|
|
|
28
29
|
Dependency injection framework for Python inspired by `dependency-injector` and `dishka`.
|
|
29
30
|
|
|
30
|
-
It is in
|
|
31
|
+
It is in development state yet and gives you the following:
|
|
31
32
|
- DI framework with IOC-container and scopes.
|
|
32
33
|
- Async and sync resolving.
|
|
33
34
|
- Python 3.10-3.13 support.
|
|
34
35
|
- Full coverage by types annotations (mypy in strict mode).
|
|
35
36
|
- Overriding dependencies for tests.
|
|
36
37
|
- Package with zero dependencies.
|
|
38
|
+
- Integration with FastAPI and LiteStar
|
|
37
39
|
|
|
38
40
|
📚 [Documentation](https://modern-di.readthedocs.io)
|
|
39
41
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from modern_di.providers.abstract import AbstractProvider
|
|
2
|
+
from modern_di.providers.container_provider import ContainerProvider
|
|
2
3
|
from modern_di.providers.context_adapter import ContextAdapter
|
|
3
4
|
from modern_di.providers.dict import Dict
|
|
4
5
|
from modern_di.providers.factory import Factory
|
|
@@ -10,6 +11,7 @@ from modern_di.providers.singleton import Singleton
|
|
|
10
11
|
|
|
11
12
|
__all__ = [
|
|
12
13
|
"AbstractProvider",
|
|
14
|
+
"ContainerProvider",
|
|
13
15
|
"ContextAdapter",
|
|
14
16
|
"Factory",
|
|
15
17
|
"Dict",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import typing
|
|
2
|
+
|
|
3
|
+
import modern_di
|
|
4
|
+
from modern_di import Container
|
|
5
|
+
from modern_di.providers import AbstractProvider
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
T_co = typing.TypeVar("T_co", covariant=True)
|
|
9
|
+
P = typing.ParamSpec("P")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ContainerProvider(AbstractProvider[modern_di.Container]):
|
|
13
|
+
__slots__ = AbstractProvider.BASE_SLOTS
|
|
14
|
+
|
|
15
|
+
async def async_resolve(self, container: Container) -> modern_di.Container:
|
|
16
|
+
return self.sync_resolve(container)
|
|
17
|
+
|
|
18
|
+
def sync_resolve(self, container: Container) -> modern_di.Container:
|
|
19
|
+
return container.find_container(self.scope)
|
|
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
|