python-injection 0.10.12.post0__py3-none-any.whl → 0.12.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- injection/__init__.py +10 -9
- injection/__init__.pyi +74 -15
- injection/_core/__init__.py +1 -1
- injection/_core/common/asynchronous.py +54 -0
- injection/_core/common/invertible.py +2 -2
- injection/_core/common/type.py +2 -5
- injection/_core/descriptors.py +25 -0
- injection/_core/hook.py +13 -10
- injection/_core/injectables.py +106 -0
- injection/_core/module.py +260 -145
- injection/integrations/fastapi.py +18 -15
- injection/testing/__init__.py +2 -2
- injection/testing/__init__.pyi +1 -1
- injection/utils.py +2 -2
- {python_injection-0.10.12.post0.dist-info → python_injection-0.12.0.dist-info}/METADATA +9 -12
- python_injection-0.12.0.dist-info/RECORD +24 -0
- {python_injection-0.10.12.post0.dist-info → python_injection-0.12.0.dist-info}/WHEEL +1 -1
- injection/integrations/blacksheep.py +0 -34
- python_injection-0.10.12.post0.dist-info/RECORD +0 -22
injection/testing/__init__.pyi
CHANGED
@@ -8,7 +8,7 @@ test_constant = _.constant
|
|
8
8
|
test_injectable = _.injectable
|
9
9
|
test_singleton = _.singleton
|
10
10
|
|
11
|
-
def load_test_profile(*
|
11
|
+
def load_test_profile(*names: str) -> ContextManager[None]:
|
12
12
|
"""
|
13
13
|
Context manager or decorator for temporary use test module.
|
14
14
|
"""
|
injection/utils.py
CHANGED
@@ -10,13 +10,13 @@ from injection import mod
|
|
10
10
|
__all__ = ("load_packages", "load_profile")
|
11
11
|
|
12
12
|
|
13
|
-
def load_profile(
|
13
|
+
def load_profile(*names: str) -> ContextManager[None]:
|
14
14
|
"""
|
15
15
|
Injection module initialization function based on profile name.
|
16
16
|
A profile name is equivalent to an injection module name.
|
17
17
|
"""
|
18
18
|
|
19
|
-
modules = tuple(mod(module_name) for module_name in
|
19
|
+
modules = tuple(mod(module_name) for module_name in names)
|
20
20
|
|
21
21
|
for module in modules:
|
22
22
|
module.unlock()
|
@@ -1,26 +1,23 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.3
|
2
2
|
Name: python-injection
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.12.0
|
4
4
|
Summary: Fast and easy dependency injection framework.
|
5
5
|
Home-page: https://github.com/100nm/python-injection
|
6
6
|
License: MIT
|
7
7
|
Keywords: dependencies,dependency,inject,injection
|
8
8
|
Author: remimd
|
9
|
-
Requires-Python: >=3.12
|
9
|
+
Requires-Python: >=3.12, <4
|
10
10
|
Classifier: Development Status :: 4 - Beta
|
11
|
-
Classifier: Intended Audience :: Developers
|
12
|
-
Classifier: License :: OSI Approved :: MIT License
|
13
|
-
Classifier: Natural Language :: English
|
14
|
-
Classifier: Operating System :: OS Independent
|
15
|
-
Classifier: Programming Language :: Python
|
16
|
-
Classifier: Programming Language :: Python :: 3
|
17
|
-
Classifier: Programming Language :: Python :: 3.12
|
18
|
-
Classifier: Programming Language :: Python :: 3.13
|
19
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
20
11
|
Classifier: Topic :: Software Development :: Libraries
|
21
12
|
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
22
13
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
23
14
|
Classifier: Topic :: Software Development :: Testing
|
15
|
+
Classifier: Programming Language :: Python
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
18
|
+
Classifier: Operating System :: OS Independent
|
19
|
+
Classifier: Intended Audience :: Developers
|
20
|
+
Classifier: Natural Language :: English
|
24
21
|
Classifier: Typing :: Typed
|
25
22
|
Project-URL: Repository, https://github.com/100nm/python-injection
|
26
23
|
Description-Content-Type: text/markdown
|
@@ -0,0 +1,24 @@
|
|
1
|
+
injection/__init__.py,sha256=1MI9kXuQfsqLGQK_5-Zm4JjecqopjGNlhsAW8iihn9M,919
|
2
|
+
injection/__init__.pyi,sha256=Gwtvo6sJVizqz0pTKNaG-Jz_NW0gSqEsoZF7T6p3V1s,8820
|
3
|
+
injection/_core/__init__.py,sha256=XERocCxCZBxPGIaOR37yeiQOZyvjHQ6a4rgRmlkUSuU,1367
|
4
|
+
injection/_core/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
+
injection/_core/common/asynchronous.py,sha256=mPlmHa6z70iJp_Km-I_WO8uOJxRoldqRbzj5qmYYDHM,1624
|
6
|
+
injection/_core/common/event.py,sha256=kev8WUESAXzMn11EJsbTcICaCvYiD556E6BOLvQ54s4,1243
|
7
|
+
injection/_core/common/invertible.py,sha256=K8ysppiKjtKdxRR8rf_pDKMkgDRpofRSUuXllxSOk4I,506
|
8
|
+
injection/_core/common/lazy.py,sha256=kCO1q4S6AdBhsP5RrihBJpgfeR4hxvMqSz1cpCgBdjo,1482
|
9
|
+
injection/_core/common/threading.py,sha256=OXm7L3p8c7O7eSkU-RTR7cobqIGMhuo-7gpDXsWKDNQ,214
|
10
|
+
injection/_core/common/type.py,sha256=c4QfvbkMfYMlNxqt-vq6QJ83ubMnw6AIVI2Rp-tV1PI,1550
|
11
|
+
injection/_core/descriptors.py,sha256=y1rFTQdCDIMLVQfuQE8ZkTPlVZKgzvwZ2Y20Si05DwM,662
|
12
|
+
injection/_core/hook.py,sha256=Qv505pr3kjOE6UitftlLh9JKX9OCNqZBRtHbFha1gqM,3130
|
13
|
+
injection/_core/injectables.py,sha256=ybaM4AUkl21eVnyyH9StQFmokJhN_tTspScSOXjTxrI,2549
|
14
|
+
injection/_core/module.py,sha256=oiR366742S3-RSzPvSEnp8CD47NyBAElz0Nnf_WUwtg,29091
|
15
|
+
injection/exceptions.py,sha256=-5Shs7R5rctQXhpMLfcjiMBCzrtFWxC88qETUIHz57s,692
|
16
|
+
injection/integrations/__init__.py,sha256=NYLcstr4ESdLj326LlDub143z6JGM1z1pCOVWhBXK10,304
|
17
|
+
injection/integrations/fastapi.py,sha256=OZyZNxqJvOr-c5Ee0G1-oHhGF7067Ugjl_qDnIiAC1I,1760
|
18
|
+
injection/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
19
|
+
injection/testing/__init__.py,sha256=Wd9sq43CJCV7GjYFSIaikIf4hJ5lfVNS7GP3iI8a1X8,719
|
20
|
+
injection/testing/__init__.pyi,sha256=Dyf1LjSj3LrjghXjM2xkMiINg-OPWQMtjCEnnfWzaDY,372
|
21
|
+
injection/utils.py,sha256=79VoIgxO1MNb_FlfRRbzfx3RXX3DPDtoxMgngfmNF-Q,1920
|
22
|
+
python_injection-0.12.0.dist-info/METADATA,sha256=rzR5MMJ1H8UnM_rMgXydL8k50svXUO9kjFZ_cpDqOUY,2958
|
23
|
+
python_injection-0.12.0.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
|
24
|
+
python_injection-0.12.0.dist-info/RECORD,,
|
@@ -1,34 +0,0 @@
|
|
1
|
-
from typing import Any, override
|
2
|
-
|
3
|
-
from injection import Module, mod
|
4
|
-
from injection.integrations import _is_installed
|
5
|
-
|
6
|
-
__all__ = ("InjectionServices",)
|
7
|
-
|
8
|
-
if _is_installed("blacksheep", __name__):
|
9
|
-
from rodi import ContainerProtocol
|
10
|
-
|
11
|
-
|
12
|
-
class InjectionServices(ContainerProtocol):
|
13
|
-
"""
|
14
|
-
BlackSheep dependency injection container implemented with `python-injection`.
|
15
|
-
"""
|
16
|
-
|
17
|
-
__slots__ = ("__module",)
|
18
|
-
|
19
|
-
__module: Module
|
20
|
-
|
21
|
-
def __init__(self, module: Module | None = None) -> None:
|
22
|
-
self.__module = module or mod()
|
23
|
-
|
24
|
-
@override
|
25
|
-
def __contains__(self, item: Any) -> bool:
|
26
|
-
return item in self.__module
|
27
|
-
|
28
|
-
@override
|
29
|
-
def register(self, obj_type: type | Any, *args: Any, **kwargs: Any) -> None:
|
30
|
-
self.__module.injectable(obj_type)
|
31
|
-
|
32
|
-
@override
|
33
|
-
def resolve[T](self, obj_type: type[T] | Any, *args: Any, **kwargs: Any) -> T:
|
34
|
-
return self.__module.find_instance(obj_type)
|
@@ -1,22 +0,0 @@
|
|
1
|
-
injection/__init__.py,sha256=6zHo40kXRsCruG23gMllEymAQ3crQkE_8Q-wV78iomU,769
|
2
|
-
injection/__init__.pyi,sha256=kYMUV96CusOcz9RvkgQiii0QaKwWz8160qeJ3mrwPgY,7308
|
3
|
-
injection/_core/__init__.py,sha256=VMGLfdu0gYh82mt7zS297rQ7CE_gHVy0gRdI8RY_ZLY,1361
|
4
|
-
injection/_core/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
-
injection/_core/common/event.py,sha256=kev8WUESAXzMn11EJsbTcICaCvYiD556E6BOLvQ54s4,1243
|
6
|
-
injection/_core/common/invertible.py,sha256=QYXMqLrkAkz_7mq-jEYKtBr1CQ5aqzplP0FG9fS0g2Y,502
|
7
|
-
injection/_core/common/lazy.py,sha256=kCO1q4S6AdBhsP5RrihBJpgfeR4hxvMqSz1cpCgBdjo,1482
|
8
|
-
injection/_core/common/threading.py,sha256=OXm7L3p8c7O7eSkU-RTR7cobqIGMhuo-7gpDXsWKDNQ,214
|
9
|
-
injection/_core/common/type.py,sha256=TQTD-f_rnAHS0VgfkWxNFU8HAWPvkAktNDQ9_23JLHM,1705
|
10
|
-
injection/_core/hook.py,sha256=_TcwhF_DONfcoBz58RxVLeA950Rs8wtZSLGepZwGBRk,3009
|
11
|
-
injection/_core/module.py,sha256=zvYqUIAV9saTYGBuKbR4tNk2AFrMxyFxNPmvMMmKoe4,25300
|
12
|
-
injection/exceptions.py,sha256=-5Shs7R5rctQXhpMLfcjiMBCzrtFWxC88qETUIHz57s,692
|
13
|
-
injection/integrations/__init__.py,sha256=NYLcstr4ESdLj326LlDub143z6JGM1z1pCOVWhBXK10,304
|
14
|
-
injection/integrations/blacksheep.py,sha256=yO5gLb_l4W3bNPFt-v2qWIL9R8PNon4JmOxQEHdi-5o,923
|
15
|
-
injection/integrations/fastapi.py,sha256=GIxpSOumBQ8r8ihBVAzbp0nd68x8YWh6zSfL7d6QLWs,1786
|
16
|
-
injection/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
17
|
-
injection/testing/__init__.py,sha256=-C38gmZJwDtLDAWJhqiaosOZWQZwwFa1M34tODcrASs,747
|
18
|
-
injection/testing/__init__.pyi,sha256=6ZXbbS-9ppMdkxd03I6yBNurmR3Xw7sM_qiokibkLeY,386
|
19
|
-
injection/utils.py,sha256=gPcxGIdrGz4irbJXGTYPw33jNy8jg56u_c61eb1MBSE,1971
|
20
|
-
python_injection-0.10.12.post0.dist-info/METADATA,sha256=j-HFgbGdjn5FcPPiMuDYQc86HKuT9-r57CWa-xIkNFs,3117
|
21
|
-
python_injection-0.10.12.post0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
22
|
-
python_injection-0.10.12.post0.dist-info/RECORD,,
|