python-injection 0.26.4__tar.gz → 0.27.0.post0__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.
Files changed (31) hide show
  1. {python_injection-0.26.4 → python_injection-0.27.0.post0}/PKG-INFO +10 -6
  2. {python_injection-0.26.4 → python_injection-0.27.0.post0}/docs/index.md +4 -4
  3. {python_injection-0.26.4 → python_injection-0.27.0.post0}/injection/loaders.py +8 -0
  4. {python_injection-0.26.4 → python_injection-0.27.0.post0}/pyproject.toml +25 -2
  5. {python_injection-0.26.4 → python_injection-0.27.0.post0}/.gitignore +0 -0
  6. {python_injection-0.26.4 → python_injection-0.27.0.post0}/LICENSE +0 -0
  7. {python_injection-0.26.4 → python_injection-0.27.0.post0}/injection/__init__.py +0 -0
  8. {python_injection-0.26.4 → python_injection-0.27.0.post0}/injection/__init__.pyi +0 -0
  9. {python_injection-0.26.4 → python_injection-0.27.0.post0}/injection/_core/__init__.py +0 -0
  10. {python_injection-0.26.4 → python_injection-0.27.0.post0}/injection/_core/asfunction.py +0 -0
  11. {python_injection-0.26.4 → python_injection-0.27.0.post0}/injection/_core/common/__init__.py +0 -0
  12. {python_injection-0.26.4 → python_injection-0.27.0.post0}/injection/_core/common/asynchronous.py +0 -0
  13. {python_injection-0.26.4 → python_injection-0.27.0.post0}/injection/_core/common/event.py +0 -0
  14. {python_injection-0.26.4 → python_injection-0.27.0.post0}/injection/_core/common/invertible.py +0 -0
  15. {python_injection-0.26.4 → python_injection-0.27.0.post0}/injection/_core/common/lazy.py +0 -0
  16. {python_injection-0.26.4 → python_injection-0.27.0.post0}/injection/_core/common/threading.py +0 -0
  17. {python_injection-0.26.4 → python_injection-0.27.0.post0}/injection/_core/common/type.py +0 -0
  18. {python_injection-0.26.4 → python_injection-0.27.0.post0}/injection/_core/descriptors.py +0 -0
  19. {python_injection-0.26.4 → python_injection-0.27.0.post0}/injection/_core/injectables.py +0 -0
  20. {python_injection-0.26.4 → python_injection-0.27.0.post0}/injection/_core/locator.py +0 -0
  21. {python_injection-0.26.4 → python_injection-0.27.0.post0}/injection/_core/module.py +0 -0
  22. {python_injection-0.26.4 → python_injection-0.27.0.post0}/injection/_core/scope.py +0 -0
  23. {python_injection-0.26.4 → python_injection-0.27.0.post0}/injection/_core/slots.py +0 -0
  24. {python_injection-0.26.4 → python_injection-0.27.0.post0}/injection/entrypoint.py +0 -0
  25. {python_injection-0.26.4 → python_injection-0.27.0.post0}/injection/exceptions.py +0 -0
  26. {python_injection-0.26.4 → python_injection-0.27.0.post0}/injection/ext/__init__.py +0 -0
  27. {python_injection-0.26.4 → python_injection-0.27.0.post0}/injection/ext/fastapi.py +0 -0
  28. {python_injection-0.26.4 → python_injection-0.27.0.post0}/injection/ext/fastapi.pyi +0 -0
  29. {python_injection-0.26.4 → python_injection-0.27.0.post0}/injection/py.typed +0 -0
  30. {python_injection-0.26.4 → python_injection-0.27.0.post0}/injection/testing/__init__.py +0 -0
  31. {python_injection-0.26.4 → python_injection-0.27.0.post0}/injection/testing/__init__.pyi +0 -0
@@ -1,14 +1,18 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: python-injection
3
- Version: 0.26.4
3
+ Version: 0.27.0.post0
4
4
  Summary: Dead-simple dependency injection framework for Python.
5
5
  Project-URL: Documentation, https://python-injection.remimd.dev
6
+ Project-URL: Issues, https://github.com/100nm/python-injection/issues
6
7
  Project-URL: Repository, https://github.com/100nm/python-injection
7
8
  Author: remimd
8
9
  License-Expression: MIT
9
10
  License-File: LICENSE
10
- Keywords: dependencies,dependency,inject,injection
11
+ Keywords: anyio,async,asyncio,container,dependencies,dependency,dependency-injection,di,fastapi,inject,injection,injector,inversion-of-control,ioc,ioc-container,scopes,singleton,type-hints
11
12
  Classifier: Development Status :: 4 - Beta
13
+ Classifier: Framework :: AnyIO
14
+ Classifier: Framework :: AsyncIO
15
+ Classifier: Framework :: FastAPI
12
16
  Classifier: Intended Audience :: Developers
13
17
  Classifier: Natural Language :: English
14
18
  Classifier: Operating System :: OS Independent
@@ -37,7 +41,7 @@ Description-Content-Type: text/markdown
37
41
 
38
42
  ## Project motivations
39
43
 
40
- Dependency injection in Python has long been a source of frustration.
44
+ Dependency injection in Python has long been a source of frustration.
41
45
 
42
46
  Existing solutions are often verbose, require extensive boilerplate, or fail to leverage Python's type hints effectively. `python-injection` was created to solve these problems once and for all by providing a simple, elegant, and powerful dependency injection framework that feels natural to Python developers.
43
47
 
@@ -47,13 +51,13 @@ The goal is straightforward: make dependency injection so easy that you'll wonde
47
51
 
48
52
  - **Type-driven resolution**: Dependencies are automatically resolved using Python's type annotations.
49
53
  - **Decorator-based registration**: Register your dependencies with simple, readable decorators.
50
- - **Flexible lifetimes**: Choose from 4 type of lifetimes to match your needs:
54
+ - **Flexible lifetimes**: Choose from four types of lifetimes to match your needs:
51
55
  - **Transient**: A new instance every time
52
56
  - **Singleton**: One instance for the entire application
53
57
  - **Scoped**: One instance per scope, with context manager support
54
- - **Constant**: Register pre-existing values
58
+ - **Constant**: A value created once and never re-resolved, either pre-existing or computed lazily
55
59
  - **Profile support**: Ability to swap certain dependencies based on a profile.
56
- - **Pull-based instantiation**: Dependencies are only created when needed, improving startup time and resource usage.
60
+ - **Pull-based instantiation**: Dependencies registered with decorators are only created when needed, improving startup time and resource usage.
57
61
  - **Full sync/async support**: Works seamlessly with both synchronous and asynchronous code.
58
62
 
59
63
  ## Installation
@@ -5,7 +5,7 @@
5
5
 
6
6
  ## Project motivations
7
7
 
8
- Dependency injection in Python has long been a source of frustration.
8
+ Dependency injection in Python has long been a source of frustration.
9
9
 
10
10
  Existing solutions are often verbose, require extensive boilerplate, or fail to leverage Python's type hints effectively. `python-injection` was created to solve these problems once and for all by providing a simple, elegant, and powerful dependency injection framework that feels natural to Python developers.
11
11
 
@@ -15,13 +15,13 @@ The goal is straightforward: make dependency injection so easy that you'll wonde
15
15
 
16
16
  - **Type-driven resolution**: Dependencies are automatically resolved using Python's type annotations.
17
17
  - **Decorator-based registration**: Register your dependencies with simple, readable decorators.
18
- - **Flexible lifetimes**: Choose from 4 type of lifetimes to match your needs:
18
+ - **Flexible lifetimes**: Choose from four types of lifetimes to match your needs:
19
19
  - **Transient**: A new instance every time
20
20
  - **Singleton**: One instance for the entire application
21
21
  - **Scoped**: One instance per scope, with context manager support
22
- - **Constant**: Register pre-existing values
22
+ - **Constant**: A value created once and never re-resolved, either pre-existing or computed lazily
23
23
  - **Profile support**: Ability to swap certain dependencies based on a profile.
24
- - **Pull-based instantiation**: Dependencies are only created when needed, improving startup time and resource usage.
24
+ - **Pull-based instantiation**: Dependencies registered with decorators are only created when needed, improving startup time and resource usage.
25
25
  - **Full sync/async support**: Works seamlessly with both synchronous and asynchronous code.
26
26
 
27
27
  ## Installation
@@ -5,6 +5,7 @@ import sys
5
5
  from abc import abstractmethod
6
6
  from collections.abc import Callable, Iterator, Mapping, Sequence
7
7
  from dataclasses import dataclass, field
8
+ from fnmatch import fnmatchcase
8
9
  from importlib import import_module
9
10
  from importlib.util import find_spec
10
11
  from os.path import isfile
@@ -99,6 +100,13 @@ class PythonModuleLoader:
99
100
  module = import_module(name) if self.predicate(name) else None
100
101
  yield name, module
101
102
 
103
+ @classmethod
104
+ def fnmatch(cls, *patterns: str) -> Self:
105
+ def predicate(module_name: str) -> bool:
106
+ return any(fnmatchcase(module_name, pattern) for pattern in patterns)
107
+
108
+ return cls(predicate)
109
+
102
110
  @classmethod
103
111
  def from_keywords(cls, *keywords: str) -> Self:
104
112
  """
@@ -24,16 +24,38 @@ test = [
24
24
 
25
25
  [project]
26
26
  name = "python-injection"
27
- version = "0.26.4"
27
+ version = "0.27.0.post0"
28
28
  description = "Dead-simple dependency injection framework for Python."
29
29
  license = "MIT"
30
30
  license-files = ["LICENSE"]
31
31
  readme = "docs/index.md"
32
32
  requires-python = ">=3.12, <3.16"
33
33
  authors = [{ name = "remimd" }]
34
- keywords = ["dependencies", "dependency", "inject", "injection"]
34
+ keywords = [
35
+ "dependency-injection",
36
+ "di",
37
+ "ioc",
38
+ "inversion-of-control",
39
+ "container",
40
+ "ioc-container",
41
+ "dependencies",
42
+ "dependency",
43
+ "inject",
44
+ "injection",
45
+ "injector",
46
+ "scopes",
47
+ "singleton",
48
+ "type-hints",
49
+ "fastapi",
50
+ "async",
51
+ "asyncio",
52
+ "anyio",
53
+ ]
35
54
  classifiers = [
36
55
  "Development Status :: 4 - Beta",
56
+ "Framework :: AnyIO",
57
+ "Framework :: AsyncIO",
58
+ "Framework :: FastAPI",
37
59
  "Topic :: Software Development :: Libraries",
38
60
  "Topic :: Software Development :: Libraries :: Application Frameworks",
39
61
  "Topic :: Software Development :: Libraries :: Python Modules",
@@ -61,6 +83,7 @@ async = [
61
83
 
62
84
  [project.urls]
63
85
  Documentation = "https://python-injection.remimd.dev"
86
+ Issues = "https://github.com/100nm/python-injection/issues"
64
87
  Repository = "https://github.com/100nm/python-injection"
65
88
 
66
89
  [tool.coverage.report]