aspyx 1.4.0__tar.gz → 1.5.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 aspyx might be problematic. Click here for more details.

Files changed (47) hide show
  1. aspyx-1.5.0/.gitignore +194 -0
  2. aspyx-1.5.0/PKG-INFO +33 -0
  3. aspyx-1.5.0/README.md +1 -0
  4. aspyx-1.5.0/pyproject.toml +22 -0
  5. aspyx-1.5.0/src/aspyx/__init__.py +1 -0
  6. {aspyx-1.4.0 → aspyx-1.5.0}/src/aspyx/di/__init__.py +3 -3
  7. aspyx-1.5.0/src/aspyx/di/aop/__init__.py +28 -0
  8. {aspyx-1.4.0 → aspyx-1.5.0}/src/aspyx/di/aop/aop.py +64 -22
  9. {aspyx-1.4.0 → aspyx-1.5.0}/src/aspyx/di/configuration/__init__.py +3 -3
  10. {aspyx-1.4.0 → aspyx-1.5.0}/src/aspyx/di/configuration/configuration.py +7 -5
  11. {aspyx-1.4.0 → aspyx-1.5.0}/src/aspyx/di/di.py +188 -44
  12. {aspyx-1.4.0 → aspyx-1.5.0}/src/aspyx/exception/__init__.py +1 -1
  13. {aspyx-1.4.0 → aspyx-1.5.0}/src/aspyx/exception/exception_manager.py +35 -18
  14. {aspyx-1.4.0 → aspyx-1.5.0}/src/aspyx/reflection/proxy.py +35 -10
  15. {aspyx-1.4.0 → aspyx-1.5.0}/src/aspyx/reflection/reflection.py +84 -20
  16. {aspyx-1.4.0 → aspyx-1.5.0}/src/aspyx/threading/__init__.py +1 -1
  17. {aspyx-1.4.0 → aspyx-1.5.0}/src/aspyx/threading/thread_local.py +6 -2
  18. {aspyx-1.4.0 → aspyx-1.5.0}/src/aspyx/util/stringbuilder.py +6 -2
  19. aspyx-1.5.0/tests/config.yaml +4 -0
  20. aspyx-1.5.0/tests/config1.yaml +4 -0
  21. aspyx-1.5.0/tests/di_import.py +14 -0
  22. aspyx-1.5.0/tests/sub_import.py +14 -0
  23. {aspyx-1.4.0 → aspyx-1.5.0}/tests/test_aop.py +31 -5
  24. {aspyx-1.4.0 → aspyx-1.5.0}/tests/test_configuration.py +10 -10
  25. {aspyx-1.4.0 → aspyx-1.5.0}/tests/test_cycle.py +15 -5
  26. {aspyx-1.4.0 → aspyx-1.5.0}/tests/test_di.py +59 -16
  27. {aspyx-1.4.0 → aspyx-1.5.0}/tests/test_exception_manager.py +12 -10
  28. {aspyx-1.4.0 → aspyx-1.5.0}/tests/test_proxy.py +13 -0
  29. aspyx-1.4.0/PKG-INFO +0 -825
  30. aspyx-1.4.0/README.md +0 -791
  31. aspyx-1.4.0/pyproject.toml +0 -24
  32. aspyx-1.4.0/setup.cfg +0 -4
  33. aspyx-1.4.0/src/aspyx/__init__.py +0 -0
  34. aspyx-1.4.0/src/aspyx/di/aop/__init__.py +0 -14
  35. aspyx-1.4.0/src/aspyx.egg-info/PKG-INFO +0 -825
  36. aspyx-1.4.0/src/aspyx.egg-info/SOURCES.txt +0 -35
  37. aspyx-1.4.0/src/aspyx.egg-info/dependency_links.txt +0 -1
  38. aspyx-1.4.0/src/aspyx.egg-info/requires.txt +0 -3
  39. aspyx-1.4.0/src/aspyx.egg-info/top_level.txt +0 -1
  40. {aspyx-1.4.0 → aspyx-1.5.0}/LICENSE +0 -0
  41. {aspyx-1.4.0 → aspyx-1.5.0}/src/aspyx/di/configuration/env_configuration_source.py +0 -0
  42. {aspyx-1.4.0 → aspyx-1.5.0}/src/aspyx/di/configuration/yaml_configuration_source.py +0 -0
  43. {aspyx-1.4.0 → aspyx-1.5.0}/src/aspyx/di/threading/__init__.py +0 -0
  44. {aspyx-1.4.0 → aspyx-1.5.0}/src/aspyx/di/threading/synchronized.py +0 -0
  45. {aspyx-1.4.0 → aspyx-1.5.0}/src/aspyx/reflection/__init__.py +0 -0
  46. {aspyx-1.4.0 → aspyx-1.5.0}/src/aspyx/util/__init__.py +0 -0
  47. {aspyx-1.4.0 → aspyx-1.5.0}/tests/test_reflection.py +0 -0
aspyx-1.5.0/.gitignore ADDED
@@ -0,0 +1,194 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+
110
+ # pdm
111
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112
+ #pdm.lock
113
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114
+ # in version control.
115
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116
+ .pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121
+ __pypackages__/
122
+
123
+ # Celery stuff
124
+ celerybeat-schedule
125
+ celerybeat.pid
126
+
127
+ # SageMath parsed files
128
+ *.sage.py
129
+
130
+ # Environments
131
+ .env
132
+ .venv
133
+ env/
134
+ venv/
135
+ ENV/
136
+ env.bak/
137
+ venv.bak/
138
+
139
+ # Spyder project settings
140
+ .spyderproject
141
+ .spyproject
142
+
143
+ # Rope project settings
144
+ .ropeproject
145
+
146
+ # mkdocs documentation
147
+ /site
148
+
149
+ # mypy
150
+ .mypy_cache/
151
+ .dmypy.json
152
+ dmypy.json
153
+
154
+ # Pyre type checker
155
+ .pyre/
156
+
157
+ # pytype static type analyzer
158
+ .pytype/
159
+
160
+ # Cython debug symbols
161
+ cython_debug/
162
+
163
+ # PyCharm
164
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
167
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
168
+ #.idea/
169
+
170
+ # Abstra
171
+ # Abstra is an AI-powered process automation framework.
172
+ # Ignore directories containing user credentials, local state, and settings.
173
+ # Learn more at https://abstra.io/docs
174
+ .abstra/
175
+
176
+ # Visual Studio Code
177
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
178
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
179
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
180
+ # you could uncomment the following to ignore the enitre vscode folder
181
+ # .vscode/
182
+
183
+ # Ruff stuff:
184
+ .ruff_cache/
185
+
186
+ # PyPI configuration file
187
+ .pypirc
188
+
189
+ # Cursor
190
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
191
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
192
+ # refer to https://docs.cursor.com/context/ignore-files
193
+ .cursorignore
194
+ .cursorindexingignore
aspyx-1.5.0/PKG-INFO ADDED
@@ -0,0 +1,33 @@
1
+ Metadata-Version: 2.4
2
+ Name: aspyx
3
+ Version: 1.5.0
4
+ Summary: A DI and AOP library for Python
5
+ Author-email: Andreas Ernst <andreas.ernst7@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 Andreas Ernst
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+ License-File: LICENSE
28
+ Requires-Python: >=3.9
29
+ Requires-Dist: python-dotenv~=1.1.0
30
+ Requires-Dist: pyyaml~=6.0.2
31
+ Description-Content-Type: text/markdown
32
+
33
+ aspyx
aspyx-1.5.0/README.md ADDED
@@ -0,0 +1 @@
1
+ aspyx
@@ -0,0 +1,22 @@
1
+ [project]
2
+ name = "aspyx"
3
+ version = "1.5.0"
4
+ description = "A DI and AOP library for Python"
5
+ authors = [{ name = "Andreas Ernst", email = "andreas.ernst7@gmail.com" }]
6
+ readme = "README.md"
7
+ license = { file = "LICENSE" }
8
+ requires-python = ">=3.9"
9
+ dependencies = [
10
+ "python-dotenv~=1.1.0",
11
+ "pyyaml~=6.0.2"
12
+ ]
13
+
14
+ [build-system]
15
+ requires = ["hatchling"]
16
+ build-backend = "hatchling.build"
17
+
18
+ [tool.hatch.build]
19
+ source = "src"
20
+
21
+ [tool.hatch.build.targets.wheel]
22
+ packages = ["src/aspyx"]
@@ -0,0 +1 @@
1
+ #
@@ -1,7 +1,7 @@
1
1
  """
2
2
  This module provides dependency injection and aop capabilities for Python applications.
3
3
  """
4
- from .di import conditional, requires_class, requires_feature, DIException, AbstractCallableProcessor, LifecycleCallable, Lifecycle, Providers, Environment, ClassInstanceProvider, injectable, factory, environment, inject, order, create, on_init, on_running, on_destroy, inject_environment, Factory, PostProcessor
4
+ from .di import InstanceProvider, conditional, requires_class, requires_feature, DIException, AbstractCallableProcessor, LifecycleCallable, Lifecycle, Providers, Environment, ClassInstanceProvider, injectable, factory, module, inject, order, create, on_init, on_running, on_destroy, inject_environment, Factory, PostProcessor
5
5
 
6
6
  # import something from the subpackages, so that the decorators are executed
7
7
 
@@ -17,11 +17,11 @@ __all__ = [
17
17
  "Environment",
18
18
  "injectable",
19
19
  "factory",
20
- "environment",
20
+ "module",
21
21
  "inject",
22
22
  "create",
23
23
  "order",
24
-
24
+ "InstanceProvider",
25
25
  "on_init",
26
26
  "on_running",
27
27
  "on_destroy",
@@ -0,0 +1,28 @@
1
+ """
2
+ The AOP module gives you the possibility to define aspects that will participate in method execution flows.
3
+
4
+ **Example**: all method executions of methods named "foo" will include a `before` aspect, that will be executed before the original method
5
+
6
+ ```python
7
+ @advice
8
+ class Advice:
9
+ @before(methods().named("foo"))
10
+ def before_call(self, invocation: Invocation):
11
+ ...
12
+
13
+ ```
14
+
15
+ Note, that this requires that both the advice and the targeted methods need to be managed by an environment.
16
+ """
17
+ from .aop import before, after, classes, around, error, advice, methods, Invocation, AspectTarget
18
+ __all__ = [
19
+ "before",
20
+ "after",
21
+ "around",
22
+ "error",
23
+ "advice",
24
+ "classes",
25
+ "methods",
26
+ "Invocation",
27
+ "AspectTarget"
28
+ ]
@@ -25,6 +25,7 @@ class AspectType(Enum):
25
25
  AspectType defines the types of aspect-oriented advice that can be applied to methods.
26
26
 
27
27
  The available types are:
28
+
28
29
  - BEFORE: Advice to be executed before the method invocation.
29
30
  - AROUND: Advice that intercepts the method invocation.
30
31
  - AFTER: Advice to be executed after the method invocation, regardless of its outcome.
@@ -98,7 +99,7 @@ class AspectTarget(ABC):
98
99
 
99
100
  # fluent
100
101
 
101
- def function(self, func):
102
+ def function(self, func) -> AspectTarget:
102
103
  self._function = func
103
104
  return self
104
105
 
@@ -107,39 +108,65 @@ class AspectTarget(ABC):
107
108
 
108
109
  return self
109
110
 
110
- def that_are_async(self):
111
+ def that_are_async(self) -> AspectTarget:
111
112
  """
112
113
  matches methods that are async
113
- :return: self
114
+
115
+ Returns:
116
+ AspectTarget: self
114
117
  """
115
118
  self._async = True
116
119
  return self
117
120
 
118
- def of_type(self, type: Type):
121
+ def of_type(self, type: Type) -> AspectTarget:
119
122
  """
120
123
  matches methods belonging to a class or classes that are subclasses of the specified type
121
- :return: self
124
+
125
+ Args:
126
+ type (Type): the type to match against
127
+
128
+ Returns:
129
+ AspectTarget: self
122
130
  """
123
131
  self.types.append(type)
124
132
  return self
125
133
 
126
- def decorated_with(self, decorator):
134
+ def decorated_with(self, decorator: Callable) -> AspectTarget:
127
135
  """
128
136
  matches methods or classes that are decorated with the specified decorator
129
- :param decorator: the decorator callable
130
- :return:
137
+
138
+ Args:
139
+ decorator (Callable): the decorator callable
140
+
141
+ Returns:
142
+ AspectTarget: self
131
143
  """
132
144
  self.decorators.append(decorator)
133
145
  return self
134
146
 
135
- def matches(self, pattern: str):
147
+ def matches(self, pattern: str) -> AspectTarget:
136
148
  """
137
149
  Matches the target against a pattern.
150
+
151
+ Args:
152
+ pattern (str): the pattern
153
+
154
+ Returns:
155
+ AspectTarget: self
138
156
  """
139
157
  self.patterns.append(re.compile(pattern))
140
158
  return self
141
159
 
142
- def named(self, name: str):
160
+ def named(self, name: str) -> AspectTarget:
161
+ """
162
+ Matches the target against a name.
163
+
164
+ Args:
165
+ name (str): the name
166
+
167
+ Returns:
168
+ AspectTarget: self
169
+ """
143
170
  self.names.append(name)
144
171
  return self
145
172
 
@@ -234,15 +261,21 @@ class MethodAspectTarget(AspectTarget):
234
261
 
235
262
  return True
236
263
 
237
- def methods():
264
+ def methods() -> AspectTarget:
238
265
  """
239
266
  Create a new AspectTarget instance to define method aspect targets.
267
+
268
+ Returns:
269
+ AspectTarget: the method target
240
270
  """
241
271
  return MethodAspectTarget()
242
272
 
243
- def classes():
273
+ def classes() -> AspectTarget:
244
274
  """
245
275
  Create a new AspectTarget instance to define class aspect targets.
276
+
277
+ Returns:
278
+ AspectTarget: the method target
246
279
  """
247
280
  return ClassAspectTarget()
248
281
 
@@ -405,7 +438,7 @@ class Invocation:
405
438
 
406
439
  def proceed(self, *args, **kwargs):
407
440
  """
408
- Proceed to the next join point in the around chain up to the original method.
441
+ Proceed to the next aspect in the around chain up to the original method.
409
442
  """
410
443
  if len(args) > 0 or len(kwargs) > 0: # as soon as we have args, we replace the current ones
411
444
  self.args = args
@@ -417,7 +450,7 @@ class Invocation:
417
450
 
418
451
  async def proceed_async(self, *args, **kwargs):
419
452
  """
420
- Proceed to the next join point in the around chain up to the original method.
453
+ Proceed to the next aspect in the around chain up to the original method.
421
454
  """
422
455
  if len(args) > 0 or len(kwargs) > 0: # as soon as we have args, we replace the current ones
423
456
  self.args = args
@@ -428,6 +461,9 @@ class Invocation:
428
461
  return await self.current_aspect.next.call_async(self)
429
462
 
430
463
  class Advices:
464
+ """
465
+ Internal utility class that collects all advice s
466
+ """
431
467
  # static data
432
468
 
433
469
  targets: list[AspectTarget] = []
@@ -443,7 +479,13 @@ class Advices:
443
479
 
444
480
  @classmethod
445
481
  def collect(cls, clazz, member, type: AspectType, environment: Environment):
446
- aspects = [FunctionAspect(environment.get(target._clazz), target._function, None) for target in Advices.targets if target._type == type and target._clazz is not clazz and environment.providers.get(target._clazz) is not None and target._matches(clazz, member)]
482
+ aspects = [
483
+ FunctionAspect(environment.get(target._clazz), target._function, None) for target in Advices.targets
484
+ if target._type == type
485
+ and target._clazz is not clazz
486
+ and environment.providers.get(target._clazz) is not None
487
+ and target._matches(clazz, member)
488
+ ]
447
489
 
448
490
  # sort according to order
449
491
 
@@ -518,8 +560,8 @@ def sanity_check(clazz: Type, name: str):
518
560
 
519
561
  def advice(cls):
520
562
  """
521
- Classes decorated with @advice are treated as advice classes.
522
- They can contain methods decorated with @before, @after, @around, or @error to define aspects.
563
+ Classes decorated with `@advice` are treated as advice classes.
564
+ They can contain methods decorated with `@before`, `@after`, `@around`, or `@error` to define aspects.
523
565
  """
524
566
  Providers.register(ClassInstanceProvider(cls, True))
525
567
 
@@ -528,7 +570,7 @@ def advice(cls):
528
570
  for name, member in TypeDescriptor.for_type(cls).methods.items():
529
571
  decorator = next((decorator for decorator in member.decorators if decorator.decorator in [before, after, around, error]), None)
530
572
  if decorator is not None:
531
- target = decorator.args[0] # ? ...?? TODO, can be multiple
573
+ target = decorator.args[0] # multiple targets are already merged in a single! check _register
532
574
  target._clazz = cls
533
575
  sanity_check(cls, name)
534
576
  Advices.targets.append(target) #??
@@ -550,7 +592,7 @@ def _register(decorator, targets: list[AspectTarget], func, aspect_type: AspectT
550
592
 
551
593
  def before(*targets: AspectTarget):
552
594
  """
553
- Methods decorated with @before will be executed before the target method is invoked.
595
+ Methods decorated with `@before` will be executed before the target method is invoked.
554
596
  """
555
597
  def decorator(func):
556
598
  _register(before, targets, func, AspectType.BEFORE)
@@ -561,7 +603,7 @@ def before(*targets: AspectTarget):
561
603
 
562
604
  def error(*targets: AspectTarget):
563
605
  """
564
- Methods decorated with @error will be executed if the target method raises an exception."""
606
+ Methods decorated with `@error` will be executed if the target method raises an exception."""
565
607
  def decorator(func):
566
608
  _register(error, targets, func, AspectType.ERROR)
567
609
 
@@ -571,7 +613,7 @@ def error(*targets: AspectTarget):
571
613
 
572
614
  def after(*targets: AspectTarget):
573
615
  """
574
- Methods decorated with @after will be executed after the target method is invoked.
616
+ Methods decorated with `@after` will be executed after the target method is invoked.
575
617
  """
576
618
  def decorator(func):
577
619
  _register(after, targets, func, AspectType.AFTER)
@@ -582,7 +624,7 @@ def after(*targets: AspectTarget):
582
624
 
583
625
  def around(*targets: AspectTarget):
584
626
  """
585
- Methods decorated with @around will be executed around the target method.
627
+ Methods decorated with `@around` will be executed around the target method.
586
628
  Every around method must accept a single parameter of type Invocation and needs to call proceed
587
629
  on this parameter to proceed to the next around method.
588
630
  """
@@ -1,7 +1,7 @@
1
1
  """
2
- Configuration value handling
2
+ This module contains functionality to read configuration values from different sources and to retrieve or inject them.
3
3
  """
4
- from .configuration import ConfigurationManager, ConfigurationSource, value
4
+ from .configuration import ConfigurationManager, ConfigurationSource, inject_value
5
5
  from .env_configuration_source import EnvConfigurationSource
6
6
  from .yaml_configuration_source import YamlConfigurationSource
7
7
 
@@ -10,5 +10,5 @@ __all__ = [
10
10
  "ConfigurationSource",
11
11
  "EnvConfigurationSource",
12
12
  "YamlConfigurationSource",
13
- "value"
13
+ "inject_value"
14
14
  ]
@@ -66,10 +66,12 @@ class ConfigurationManager:
66
66
  def get(self, path: str, type: Type[T], default : Optional[T]=None) -> T:
67
67
  """
68
68
  Retrieve a configuration value by path and type, with optional coercion.
69
- Arguments:
69
+
70
+ Args:
70
71
  path (str): The path to the configuration value, e.g. "database.host".
71
72
  type (Type[T]): The expected type.
72
73
  default (Optional[T]): The default value to return if the path is not found.
74
+
73
75
  Returns:
74
76
  T: The configuration value coerced to the specified type, or the default value if not found.
75
77
  """
@@ -119,17 +121,17 @@ class ConfigurationSource(ABC):
119
121
 
120
122
  # decorator
121
123
 
122
- def value(key: str, default=None):
124
+ def inject_value(key: str, default=None):
123
125
  """
124
126
  Decorator to inject a configuration value into a method.
125
127
 
126
- Arguments:
128
+ Args:
127
129
  key (str): The configuration key to inject.
128
130
  default: The default value to use if the key is not found.
129
131
 
130
132
  """
131
133
  def decorator(func):
132
- Decorators.add(func, value, key, default)
134
+ Decorators.add(func, inject_value, key, default)
133
135
 
134
136
  return func
135
137
 
@@ -139,7 +141,7 @@ def value(key: str, default=None):
139
141
  @order(9)
140
142
  class ConfigurationLifecycleCallable(LifecycleCallable):
141
143
  def __init__(self, manager: ConfigurationManager):
142
- super().__init__(value, Lifecycle.ON_INJECT)
144
+ super().__init__(inject_value, Lifecycle.ON_INJECT)
143
145
 
144
146
  self.manager = manager
145
147