anydi 0.48.2__tar.gz → 0.50.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.
- {anydi-0.48.2 → anydi-0.50.0}/PKG-INFO +4 -4
- {anydi-0.48.2 → anydi-0.50.0}/README.md +1 -1
- {anydi-0.48.2 → anydi-0.50.0}/anydi/_async.py +2 -1
- {anydi-0.48.2 → anydi-0.50.0}/anydi/_container.py +7 -5
- {anydi-0.48.2 → anydi-0.50.0}/anydi/_decorators.py +1 -2
- {anydi-0.48.2 → anydi-0.50.0}/anydi/_module.py +2 -1
- {anydi-0.48.2 → anydi-0.50.0}/anydi/_provider.py +2 -1
- {anydi-0.48.2 → anydi-0.50.0}/anydi/_scan.py +4 -4
- {anydi-0.48.2 → anydi-0.50.0}/anydi/_typing.py +5 -43
- {anydi-0.48.2 → anydi-0.50.0}/anydi/ext/django/apps.py +2 -1
- {anydi-0.48.2 → anydi-0.50.0}/anydi/ext/django/middleware.py +2 -1
- {anydi-0.48.2 → anydi-0.50.0}/anydi/ext/pydantic_settings.py +2 -2
- {anydi-0.48.2 → anydi-0.50.0}/anydi/ext/pytest_plugin.py +2 -2
- {anydi-0.48.2 → anydi-0.50.0}/anydi/testing.py +1 -2
- {anydi-0.48.2 → anydi-0.50.0}/pyproject.toml +7 -38
- {anydi-0.48.2 → anydi-0.50.0}/anydi/__init__.py +0 -0
- {anydi-0.48.2 → anydi-0.50.0}/anydi/_context.py +0 -0
- {anydi-0.48.2 → anydi-0.50.0}/anydi/_scope.py +0 -0
- {anydi-0.48.2 → anydi-0.50.0}/anydi/ext/__init__.py +0 -0
- {anydi-0.48.2 → anydi-0.50.0}/anydi/ext/django/__init__.py +0 -0
- {anydi-0.48.2 → anydi-0.50.0}/anydi/ext/django/_container.py +0 -0
- {anydi-0.48.2 → anydi-0.50.0}/anydi/ext/django/_settings.py +0 -0
- {anydi-0.48.2 → anydi-0.50.0}/anydi/ext/django/_utils.py +0 -0
- {anydi-0.48.2 → anydi-0.50.0}/anydi/ext/django/ninja/__init__.py +0 -0
- {anydi-0.48.2 → anydi-0.50.0}/anydi/ext/django/ninja/_operation.py +0 -0
- {anydi-0.48.2 → anydi-0.50.0}/anydi/ext/django/ninja/_signature.py +0 -0
- {anydi-0.48.2 → anydi-0.50.0}/anydi/ext/fastapi.py +0 -0
- {anydi-0.48.2 → anydi-0.50.0}/anydi/ext/faststream.py +0 -0
- {anydi-0.48.2 → anydi-0.50.0}/anydi/ext/starlette/__init__.py +0 -0
- {anydi-0.48.2 → anydi-0.50.0}/anydi/ext/starlette/middleware.py +0 -0
- {anydi-0.48.2 → anydi-0.50.0}/anydi/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: anydi
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.50.0
|
|
4
4
|
Summary: Dependency Injection library
|
|
5
5
|
Keywords: dependency injection,dependencies,di,async,asyncio,application
|
|
6
6
|
Author: Anton Ruhlov
|
|
@@ -20,16 +20,16 @@ Classifier: Environment :: Web Environment
|
|
|
20
20
|
Classifier: Intended Audience :: Developers
|
|
21
21
|
Classifier: License :: OSI Approved :: MIT License
|
|
22
22
|
Classifier: Programming Language :: Python :: 3
|
|
23
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
24
23
|
Classifier: Programming Language :: Python :: 3.10
|
|
25
24
|
Classifier: Programming Language :: Python :: 3.11
|
|
26
25
|
Classifier: Programming Language :: Python :: 3.12
|
|
27
26
|
Classifier: Programming Language :: Python :: 3.13
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
28
28
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
29
29
|
Requires-Dist: typing-extensions>=4.15.0,<5
|
|
30
30
|
Requires-Dist: anyio>=3.7.1
|
|
31
31
|
Requires-Dist: wrapt>=1.17.0,<2
|
|
32
|
-
Requires-Python: >=3.
|
|
32
|
+
Requires-Python: >=3.10.0, <3.15
|
|
33
33
|
Project-URL: Repository, https://github.com/antonrh/anydi
|
|
34
34
|
Description-Content-Type: text/markdown
|
|
35
35
|
|
|
@@ -58,7 +58,7 @@ http://anydi.readthedocs.io/
|
|
|
58
58
|
|
|
59
59
|
---
|
|
60
60
|
|
|
61
|
-
`AnyDI` is a modern, lightweight Dependency Injection library suitable for any synchronous or asynchronous applications with Python 3.
|
|
61
|
+
`AnyDI` is a modern, lightweight Dependency Injection library suitable for any synchronous or asynchronous applications with Python 3.10+, based on type annotations ([PEP 484](https://peps.python.org/pep-0484/)).
|
|
62
62
|
|
|
63
63
|
The key features are:
|
|
64
64
|
|
|
@@ -23,7 +23,7 @@ http://anydi.readthedocs.io/
|
|
|
23
23
|
|
|
24
24
|
---
|
|
25
25
|
|
|
26
|
-
`AnyDI` is a modern, lightweight Dependency Injection library suitable for any synchronous or asynchronous applications with Python 3.
|
|
26
|
+
`AnyDI` is a modern, lightweight Dependency Injection library suitable for any synchronous or asynchronous applications with Python 3.10+, based on type annotations ([PEP 484](https://peps.python.org/pep-0484/)).
|
|
27
27
|
|
|
28
28
|
The key features are:
|
|
29
29
|
|
|
@@ -9,11 +9,11 @@ import logging
|
|
|
9
9
|
import types
|
|
10
10
|
import uuid
|
|
11
11
|
from collections import defaultdict
|
|
12
|
-
from collections.abc import AsyncIterator, Iterable, Iterator
|
|
12
|
+
from collections.abc import AsyncIterator, Callable, Iterable, Iterator
|
|
13
13
|
from contextvars import ContextVar
|
|
14
|
-
from typing import Annotated, Any,
|
|
14
|
+
from typing import Annotated, Any, TypeVar, cast, get_args, get_origin, overload
|
|
15
15
|
|
|
16
|
-
from typing_extensions import ParamSpec, Self,
|
|
16
|
+
from typing_extensions import ParamSpec, Self, type_repr
|
|
17
17
|
|
|
18
18
|
from ._async import run_sync
|
|
19
19
|
from ._context import InstanceContext
|
|
@@ -33,7 +33,6 @@ from ._typing import (
|
|
|
33
33
|
is_inject_marker,
|
|
34
34
|
is_iterator_type,
|
|
35
35
|
is_none_type,
|
|
36
|
-
type_repr,
|
|
37
36
|
)
|
|
38
37
|
|
|
39
38
|
T = TypeVar("T", bound=Any)
|
|
@@ -808,7 +807,10 @@ class Container:
|
|
|
808
807
|
marker = metadata[-1]
|
|
809
808
|
new_metadata = metadata[:-1]
|
|
810
809
|
if new_metadata:
|
|
811
|
-
|
|
810
|
+
if hasattr(Annotated, "__getitem__"):
|
|
811
|
+
new_annotation = Annotated.__getitem__((origin, *new_metadata)) # type: ignore
|
|
812
|
+
else:
|
|
813
|
+
new_annotation = Annotated.__class_getitem__((origin, *new_metadata)) # type: ignore
|
|
812
814
|
else:
|
|
813
815
|
new_annotation = origin
|
|
814
816
|
return parameter.replace(annotation=new_annotation, default=marker)
|
|
@@ -2,9 +2,10 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import enum
|
|
4
4
|
import inspect
|
|
5
|
+
from collections.abc import Callable
|
|
5
6
|
from dataclasses import dataclass
|
|
6
7
|
from functools import cached_property
|
|
7
|
-
from typing import Any,
|
|
8
|
+
from typing import Any, NamedTuple
|
|
8
9
|
|
|
9
10
|
from ._scope import Scope
|
|
10
11
|
from ._typing import NOT_SET
|
|
@@ -3,10 +3,10 @@ from __future__ import annotations
|
|
|
3
3
|
import importlib
|
|
4
4
|
import inspect
|
|
5
5
|
import pkgutil
|
|
6
|
-
from collections.abc import Iterable
|
|
6
|
+
from collections.abc import Callable, Iterable
|
|
7
7
|
from dataclasses import dataclass
|
|
8
8
|
from types import ModuleType
|
|
9
|
-
from typing import TYPE_CHECKING, Any
|
|
9
|
+
from typing import TYPE_CHECKING, Any
|
|
10
10
|
|
|
11
11
|
from ._decorators import is_injectable
|
|
12
12
|
from ._typing import get_typed_parameters, is_inject_marker
|
|
@@ -14,8 +14,8 @@ from ._typing import get_typed_parameters, is_inject_marker
|
|
|
14
14
|
if TYPE_CHECKING:
|
|
15
15
|
from ._container import Container
|
|
16
16
|
|
|
17
|
-
Package =
|
|
18
|
-
PackageOrIterable =
|
|
17
|
+
Package = ModuleType | str
|
|
18
|
+
PackageOrIterable = Package | Iterable[Package]
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
@dataclass(kw_only=True)
|
|
@@ -3,44 +3,9 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import inspect
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
from
|
|
9
|
-
from typing import Any, Callable, ForwardRef, TypeVar
|
|
10
|
-
|
|
11
|
-
from typing_extensions import get_args, get_origin
|
|
12
|
-
|
|
13
|
-
try:
|
|
14
|
-
from types import NoneType
|
|
15
|
-
except ImportError:
|
|
16
|
-
NoneType = type(None)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
T = TypeVar("T")
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def type_repr(obj: Any) -> str:
|
|
23
|
-
"""Get a string representation of a type or object."""
|
|
24
|
-
if isinstance(obj, str):
|
|
25
|
-
return obj
|
|
26
|
-
|
|
27
|
-
# Get module and qualname with defaults to handle non-types directly
|
|
28
|
-
module = getattr(obj, "__module__", type(obj).__module__)
|
|
29
|
-
qualname = getattr(obj, "__qualname__", type(obj).__qualname__)
|
|
30
|
-
|
|
31
|
-
origin = get_origin(obj)
|
|
32
|
-
# If origin exists, handle generics recursively
|
|
33
|
-
if origin:
|
|
34
|
-
args = ", ".join(type_repr(arg) for arg in get_args(obj))
|
|
35
|
-
return f"{type_repr(origin)}[{args}]"
|
|
36
|
-
|
|
37
|
-
# Substitute standard library prefixes for clarity
|
|
38
|
-
full_qualname = f"{module}.{qualname}"
|
|
39
|
-
return re.sub(
|
|
40
|
-
r"\b(builtins|typing|typing_extensions|collections\.abc|types)\.",
|
|
41
|
-
"",
|
|
42
|
-
full_qualname,
|
|
43
|
-
)
|
|
6
|
+
from collections.abc import AsyncIterator, Callable, Iterator
|
|
7
|
+
from types import NoneType
|
|
8
|
+
from typing import Any, ForwardRef
|
|
44
9
|
|
|
45
10
|
|
|
46
11
|
def is_context_manager(obj: Any) -> bool:
|
|
@@ -68,11 +33,8 @@ def get_typed_annotation(
|
|
|
68
33
|
) -> Any:
|
|
69
34
|
"""Get the typed annotation of a callable object."""
|
|
70
35
|
if isinstance(annotation, str):
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
else:
|
|
74
|
-
ref = ForwardRef(annotation)
|
|
75
|
-
annotation = ref._evaluate(globalns, globalns, recursive_guard=frozenset()) # noqa
|
|
36
|
+
ref = ForwardRef(annotation, module=module)
|
|
37
|
+
annotation = ref._evaluate(globalns, globalns, recursive_guard=frozenset()) # type: ignore[reportDeprecated]
|
|
76
38
|
return annotation
|
|
77
39
|
|
|
78
40
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from collections.abc import Iterable
|
|
4
|
-
from typing import Annotated, Any
|
|
3
|
+
from collections.abc import Callable, Iterable
|
|
4
|
+
from typing import Annotated, Any
|
|
5
5
|
|
|
6
6
|
from pydantic.fields import ComputedFieldInfo, FieldInfo # noqa
|
|
7
7
|
from pydantic_settings import BaseSettings
|
|
@@ -2,8 +2,8 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import inspect
|
|
4
4
|
import logging
|
|
5
|
-
from collections.abc import Iterator
|
|
6
|
-
from typing import Any,
|
|
5
|
+
from collections.abc import Callable, Iterator
|
|
6
|
+
from typing import Any, cast
|
|
7
7
|
|
|
8
8
|
import pytest
|
|
9
9
|
from anyio.pytest_plugin import extract_backend_and_options, get_runner
|
|
@@ -5,14 +5,13 @@ from collections.abc import Iterable, Iterator, Sequence
|
|
|
5
5
|
from typing import Any, TypeVar
|
|
6
6
|
|
|
7
7
|
import wrapt # type: ignore
|
|
8
|
-
from typing_extensions import Self
|
|
8
|
+
from typing_extensions import Self, type_repr
|
|
9
9
|
|
|
10
10
|
from ._container import Container
|
|
11
11
|
from ._context import InstanceContext
|
|
12
12
|
from ._module import ModuleDef
|
|
13
13
|
from ._provider import Provider, ProviderDef
|
|
14
14
|
from ._scope import Scope
|
|
15
|
-
from ._typing import type_repr
|
|
16
15
|
|
|
17
16
|
T = TypeVar("T")
|
|
18
17
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "anydi"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.50.0"
|
|
4
4
|
description = "Dependency Injection library"
|
|
5
5
|
authors = [{ name = "Anton Ruhlov", email = "antonruhlov@gmail.com" }]
|
|
6
|
-
requires-python = ">=3.
|
|
6
|
+
requires-python = ">=3.10.0, <3.15"
|
|
7
7
|
readme = "README.md"
|
|
8
8
|
license = "MIT"
|
|
9
9
|
keywords = [
|
|
@@ -29,11 +29,11 @@ classifiers = [
|
|
|
29
29
|
"Intended Audience :: Developers",
|
|
30
30
|
"License :: OSI Approved :: MIT License",
|
|
31
31
|
"Programming Language :: Python :: 3",
|
|
32
|
-
"Programming Language :: Python :: 3.9",
|
|
33
32
|
"Programming Language :: Python :: 3.10",
|
|
34
33
|
"Programming Language :: Python :: 3.11",
|
|
35
34
|
"Programming Language :: Python :: 3.12",
|
|
36
35
|
"Programming Language :: Python :: 3.13",
|
|
36
|
+
"Programming Language :: Python :: 3.14",
|
|
37
37
|
"Programming Language :: Python :: 3 :: Only",
|
|
38
38
|
]
|
|
39
39
|
dependencies = [
|
|
@@ -50,9 +50,11 @@ anydi = "anydi.ext.pytest_plugin"
|
|
|
50
50
|
|
|
51
51
|
[dependency-groups]
|
|
52
52
|
dev = [
|
|
53
|
-
"ruff>=0.
|
|
53
|
+
"ruff>=0.14.0",
|
|
54
|
+
"pyright>=1.1.406",
|
|
54
55
|
"pytest>=8.4.0,<9",
|
|
55
56
|
"pytest-cov>=6.0.0,<7",
|
|
57
|
+
"pytest-mock>=3.14.1",
|
|
56
58
|
"starlette>=0.37.2",
|
|
57
59
|
"fastapi>=0.100.0",
|
|
58
60
|
"httpx>=0.26.0",
|
|
@@ -63,9 +65,6 @@ dev = [
|
|
|
63
65
|
"faststream>=0.5.10,<0.6",
|
|
64
66
|
"redis>=5.0.4,<6",
|
|
65
67
|
"pydantic-settings>=2.4.0,<3",
|
|
66
|
-
"bump-my-version>=1.1.4",
|
|
67
|
-
"pyright>=1.1.405",
|
|
68
|
-
"pytest-mock>=3.14.1",
|
|
69
68
|
]
|
|
70
69
|
docs = [
|
|
71
70
|
"mkdocs>=1.4.2,<2",
|
|
@@ -82,7 +81,7 @@ module-root = "."
|
|
|
82
81
|
|
|
83
82
|
[tool.ruff]
|
|
84
83
|
line-length = 88
|
|
85
|
-
target-version = "
|
|
84
|
+
target-version = "py310"
|
|
86
85
|
include = [
|
|
87
86
|
"anydi/**/*.py",
|
|
88
87
|
"tests/**/*.py",
|
|
@@ -139,33 +138,3 @@ omit = [
|
|
|
139
138
|
"anydi/ext/django/ninja/_operation.py",
|
|
140
139
|
"anydi/ext/django/ninja/_signature.py",
|
|
141
140
|
]
|
|
142
|
-
|
|
143
|
-
[tool.bumpversion]
|
|
144
|
-
current_version = "0.48.2"
|
|
145
|
-
parse = """(?x)
|
|
146
|
-
(?P<major>0|[1-9]\\d*)\\.
|
|
147
|
-
(?P<minor>0|[1-9]\\d*)\\.
|
|
148
|
-
(?P<patch>0|[1-9]\\d*)
|
|
149
|
-
(?:
|
|
150
|
-
- # dash separator for pre-release section
|
|
151
|
-
(?P<pre_l>[a-zA-Z-]+) # pre-release label
|
|
152
|
-
(?P<pre_n>0|[1-9]\\d*) # pre-release version number
|
|
153
|
-
)? # pre-release section is optional
|
|
154
|
-
"""
|
|
155
|
-
serialize = [
|
|
156
|
-
"{major}.{minor}.{patch}-{pre_l}{pre_n}",
|
|
157
|
-
"{major}.{minor}.{patch}",
|
|
158
|
-
]
|
|
159
|
-
search = "{current_version}"
|
|
160
|
-
replace = "{new_version}"
|
|
161
|
-
message = "Bump version: {current_version} → {new_version}"
|
|
162
|
-
|
|
163
|
-
[[tool.bumpversion.files]]
|
|
164
|
-
filename = "pyproject.toml"
|
|
165
|
-
search = "version = \"{current_version}\""
|
|
166
|
-
replace = "version = \"{new_version}\""
|
|
167
|
-
|
|
168
|
-
[tool.bumpversion.parts.pre_l]
|
|
169
|
-
values = ["rc", "final"]
|
|
170
|
-
optional_value = "final"
|
|
171
|
-
|
|
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
|