injectq 0.1.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.
- injectq/__init__.py +145 -0
- injectq/components/__init__.py +623 -0
- injectq/core/__init__.py +36 -0
- injectq/core/async_scopes.py +328 -0
- injectq/core/base_scope_manager.py +39 -0
- injectq/core/container.py +368 -0
- injectq/core/registry.py +176 -0
- injectq/core/resolver.py +288 -0
- injectq/core/scopes.py +243 -0
- injectq/core/thread_safe_resolver.py +495 -0
- injectq/core/thread_safety.py +313 -0
- injectq/decorators/__init__.py +28 -0
- injectq/decorators/inject.py +230 -0
- injectq/decorators/resource.py +413 -0
- injectq/decorators/singleton.py +141 -0
- injectq/diagnostics/__init__.py +8 -0
- injectq/diagnostics/profiling.py +415 -0
- injectq/diagnostics/validation.py +476 -0
- injectq/diagnostics/visualization.py +509 -0
- injectq/integrations/__init__.py +0 -0
- injectq/integrations/fastapi.py +49 -0
- injectq/integrations/taskiq.py +82 -0
- injectq/modules/__init__.py +12 -0
- injectq/modules/base.py +201 -0
- injectq/py.typed +3 -0
- injectq/testing/__init__.py +22 -0
- injectq/testing/utilities.py +192 -0
- injectq/utils/__init__.py +92 -0
- injectq/utils/exceptions.py +36 -0
- injectq/utils/helpers.py +141 -0
- injectq/utils/protocols.py +156 -0
- injectq/utils/types.py +116 -0
- injectq-0.1.0.dist-info/METADATA +109 -0
- injectq-0.1.0.dist-info/RECORD +36 -0
- injectq-0.1.0.dist-info/WHEEL +4 -0
- injectq-0.1.0.dist-info/licenses/LICENSE +21 -0
injectq/__init__.py
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"""InjectQ - Modern Python dependency injection library.
|
|
2
|
+
|
|
3
|
+
Combines the simplicity of kink, the power of python-injector,
|
|
4
|
+
and the advanced features of modern DI frameworks.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
__version__ = "0.1.0"
|
|
8
|
+
|
|
9
|
+
# Core exports
|
|
10
|
+
# Testing exports
|
|
11
|
+
from . import testing
|
|
12
|
+
|
|
13
|
+
# Component exports
|
|
14
|
+
from .components import (
|
|
15
|
+
Component,
|
|
16
|
+
ComponentBinding,
|
|
17
|
+
ComponentContainer,
|
|
18
|
+
ComponentError,
|
|
19
|
+
ComponentInterface,
|
|
20
|
+
ComponentRegistry,
|
|
21
|
+
ComponentScope,
|
|
22
|
+
ComponentState,
|
|
23
|
+
)
|
|
24
|
+
from .core import (
|
|
25
|
+
InjectQ,
|
|
26
|
+
Scope,
|
|
27
|
+
ScopeType,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
# Decorator exports
|
|
31
|
+
from .decorators import (
|
|
32
|
+
Inject,
|
|
33
|
+
async_managed_resource,
|
|
34
|
+
get_resource_manager,
|
|
35
|
+
inject,
|
|
36
|
+
inject_into,
|
|
37
|
+
managed_resource,
|
|
38
|
+
register_as,
|
|
39
|
+
resource,
|
|
40
|
+
scoped,
|
|
41
|
+
singleton,
|
|
42
|
+
transient,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
# Diagnostics exports
|
|
46
|
+
from .diagnostics import (
|
|
47
|
+
DependencyProfiler,
|
|
48
|
+
DependencyValidator,
|
|
49
|
+
DependencyVisualizer,
|
|
50
|
+
)
|
|
51
|
+
from .modules import (
|
|
52
|
+
ConfigurationModule,
|
|
53
|
+
Module,
|
|
54
|
+
ProviderModule,
|
|
55
|
+
SimpleModule,
|
|
56
|
+
provider,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
# Utility exports
|
|
60
|
+
from .utils import (
|
|
61
|
+
AsyncFactory,
|
|
62
|
+
AsyncProvider,
|
|
63
|
+
AsyncResourceProvider,
|
|
64
|
+
BindingError,
|
|
65
|
+
CircularDependencyError,
|
|
66
|
+
Configurable,
|
|
67
|
+
DependencyNotFoundError,
|
|
68
|
+
Factory,
|
|
69
|
+
Injectable,
|
|
70
|
+
InjectionError,
|
|
71
|
+
InjectQError,
|
|
72
|
+
Provider,
|
|
73
|
+
Resolvable,
|
|
74
|
+
ResourceProvider,
|
|
75
|
+
ScopeAware,
|
|
76
|
+
ScopeError,
|
|
77
|
+
ServiceFactory,
|
|
78
|
+
# Type utilities and protocols
|
|
79
|
+
ServiceKey,
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
__all__ = [
|
|
84
|
+
"BindingError",
|
|
85
|
+
"CircularDependencyError",
|
|
86
|
+
# Components
|
|
87
|
+
"Component",
|
|
88
|
+
"ComponentBinding",
|
|
89
|
+
"ComponentContainer",
|
|
90
|
+
"ComponentError",
|
|
91
|
+
"ComponentInterface",
|
|
92
|
+
"ComponentRegistry",
|
|
93
|
+
"ComponentScope",
|
|
94
|
+
"ComponentState",
|
|
95
|
+
"ConfigurationModule",
|
|
96
|
+
"DependencyNotFoundError",
|
|
97
|
+
# Diagnostics
|
|
98
|
+
"DependencyProfiler",
|
|
99
|
+
"DependencyValidator",
|
|
100
|
+
"DependencyVisualizer",
|
|
101
|
+
"Inject",
|
|
102
|
+
# Core classes
|
|
103
|
+
"InjectQ",
|
|
104
|
+
# Integrations
|
|
105
|
+
# Exceptions
|
|
106
|
+
"InjectQError",
|
|
107
|
+
"InjectionError",
|
|
108
|
+
# Modules
|
|
109
|
+
"Module",
|
|
110
|
+
"ProviderModule",
|
|
111
|
+
"Scope",
|
|
112
|
+
"ScopeError",
|
|
113
|
+
"ScopeType",
|
|
114
|
+
"SimpleModule",
|
|
115
|
+
"async_managed_resource",
|
|
116
|
+
"get_resource_manager",
|
|
117
|
+
# Decorators
|
|
118
|
+
"inject",
|
|
119
|
+
"inject_into",
|
|
120
|
+
"managed_resource",
|
|
121
|
+
"provider",
|
|
122
|
+
"register_as",
|
|
123
|
+
"resource",
|
|
124
|
+
"scoped",
|
|
125
|
+
"singleton",
|
|
126
|
+
# Testing
|
|
127
|
+
"testing",
|
|
128
|
+
"transient",
|
|
129
|
+
# Type utilities and protocols
|
|
130
|
+
"ServiceKey",
|
|
131
|
+
"ServiceFactory",
|
|
132
|
+
"Injectable",
|
|
133
|
+
"Provider",
|
|
134
|
+
"AsyncProvider",
|
|
135
|
+
"Factory",
|
|
136
|
+
"AsyncFactory",
|
|
137
|
+
"ResourceProvider",
|
|
138
|
+
"AsyncResourceProvider",
|
|
139
|
+
"Resolvable",
|
|
140
|
+
"Configurable",
|
|
141
|
+
"ScopeAware",
|
|
142
|
+
]
|
|
143
|
+
|
|
144
|
+
# Create default container instance for convenience
|
|
145
|
+
injectq = InjectQ.get_instance()
|