anydi 0.38.2rc1__tar.gz → 0.39.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.38.2rc1 → anydi-0.39.0}/PKG-INFO +4 -2
- {anydi-0.38.2rc1 → anydi-0.39.0}/README.md +3 -1
- {anydi-0.38.2rc1 → anydi-0.39.0}/anydi/_container.py +3 -3
- {anydi-0.38.2rc1 → anydi-0.39.0}/docs/index.md +3 -1
- {anydi-0.38.2rc1 → anydi-0.39.0}/docs/usage.md +1 -1
- {anydi-0.38.2rc1 → anydi-0.39.0}/pyproject.toml +2 -2
- {anydi-0.38.2rc1 → anydi-0.39.0}/uv.lock +1 -1
- {anydi-0.38.2rc1 → anydi-0.39.0}/.editorconfig +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/.github/workflows/ci.yml +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/.gitignore +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/.readthedocs.yaml +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/LICENSE +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/Makefile +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/anydi/__init__.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/anydi/_context.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/anydi/_types.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/anydi/_utils.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/anydi/ext/__init__.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/anydi/ext/_utils.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/anydi/ext/django/__init__.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/anydi/ext/django/_container.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/anydi/ext/django/_settings.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/anydi/ext/django/_utils.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/anydi/ext/django/apps.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/anydi/ext/django/middleware.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/anydi/ext/django/ninja/__init__.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/anydi/ext/django/ninja/_operation.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/anydi/ext/django/ninja/_signature.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/anydi/ext/fastapi.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/anydi/ext/faststream.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/anydi/ext/pydantic_settings.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/anydi/ext/pytest_plugin.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/anydi/ext/starlette/__init__.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/anydi/ext/starlette/middleware.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/anydi/py.typed +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/docs/examples/basic.md +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/docs/extensions/django.md +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/docs/extensions/fastapi.md +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/docs/extensions/faststream.md +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/docs/extensions/pydantic_settings.md +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/mkdocs.yml +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/__init__.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/conftest.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/__init__.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/django/__init__.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/django/api/__init__.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/django/api/router.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/django/api/test_router.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/django/api/urls.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/django/conftest.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/django/container.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/django/scan/__init__.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/django/services.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/django/settings.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/django/test_views.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/django/urls.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/django/views.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/fastapi/__init__.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/fastapi/app.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/fastapi/conftest.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/fastapi/test_auto_register.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/fastapi/test_ext.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/fastapi/test_routes.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/faststream/__init__.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/faststream/test_ext.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/faststream/test_subscribers.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/fixtures.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/starlette/__init__.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/starlette/app.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/starlette/conftest.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/starlette/test_routes.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/test_pydantic.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/ext/test_pytest_plugin.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/fixtures.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/scan_app/__init__.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/scan_app/a/__init__.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/scan_app/a/a1/__init__.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/scan_app/a/a1/handlers.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/scan_app/a/a2/__init__.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/scan_app/a/a2/a21/__init__.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/scan_app/a/a2/a21/handlers.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/scan_app/a/a3/__init__.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/scan_app/a/a3/handlers.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/scan_app/b/__init__.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/scan_app/b/handlers.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/test_container.py +0 -0
- {anydi-0.38.2rc1 → anydi-0.39.0}/tests/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: anydi
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.39.0
|
|
4
4
|
Summary: Dependency Injection library
|
|
5
5
|
Project-URL: Repository, https://github.com/antonrh/anydi
|
|
6
6
|
Author-email: Anton Ruhlov <antonruhlov@gmail.com>
|
|
@@ -108,6 +108,8 @@ if __name__ == "__main__":
|
|
|
108
108
|
*app.py*
|
|
109
109
|
|
|
110
110
|
```python
|
|
111
|
+
from typing import Annotated
|
|
112
|
+
|
|
111
113
|
from fastapi import FastAPI
|
|
112
114
|
|
|
113
115
|
import anydi.ext.fastapi
|
|
@@ -126,7 +128,7 @@ app = FastAPI()
|
|
|
126
128
|
|
|
127
129
|
|
|
128
130
|
@app.get("/hello")
|
|
129
|
-
def say_hello(message: str
|
|
131
|
+
def say_hello(message: Annotated[str, Inject()]) -> dict[str, str]:
|
|
130
132
|
return {"message": message}
|
|
131
133
|
|
|
132
134
|
|
|
@@ -73,6 +73,8 @@ if __name__ == "__main__":
|
|
|
73
73
|
*app.py*
|
|
74
74
|
|
|
75
75
|
```python
|
|
76
|
+
from typing import Annotated
|
|
77
|
+
|
|
76
78
|
from fastapi import FastAPI
|
|
77
79
|
|
|
78
80
|
import anydi.ext.fastapi
|
|
@@ -91,7 +93,7 @@ app = FastAPI()
|
|
|
91
93
|
|
|
92
94
|
|
|
93
95
|
@app.get("/hello")
|
|
94
|
-
def say_hello(message: str
|
|
96
|
+
def say_hello(message: Annotated[str, Inject()]) -> dict[str, str]:
|
|
95
97
|
return {"message": message}
|
|
96
98
|
|
|
97
99
|
|
|
@@ -547,7 +547,7 @@ class Container:
|
|
|
547
547
|
|
|
548
548
|
async def aresolve(self, interface: type[T]) -> T:
|
|
549
549
|
"""Resolve an instance by interface asynchronously."""
|
|
550
|
-
return await self.
|
|
550
|
+
return await self._aresolve_or_create(interface, False)
|
|
551
551
|
|
|
552
552
|
def create(self, interface: type[T], /, **defaults: Any) -> T:
|
|
553
553
|
"""Create an instance by interface."""
|
|
@@ -555,7 +555,7 @@ class Container:
|
|
|
555
555
|
|
|
556
556
|
async def acreate(self, interface: type[T], /, **defaults: Any) -> T:
|
|
557
557
|
"""Create an instance by interface asynchronously."""
|
|
558
|
-
return await self.
|
|
558
|
+
return await self._aresolve_or_create(interface, True, **defaults)
|
|
559
559
|
|
|
560
560
|
def is_resolved(self, interface: AnyInterface) -> bool:
|
|
561
561
|
"""Check if an instance by interface exists."""
|
|
@@ -615,7 +615,7 @@ class Container:
|
|
|
615
615
|
|
|
616
616
|
return cast(T, instance)
|
|
617
617
|
|
|
618
|
-
async def
|
|
618
|
+
async def _aresolve_or_create(
|
|
619
619
|
self, interface: type[T], create: bool, /, **defaults: Any
|
|
620
620
|
) -> T:
|
|
621
621
|
"""Internal method to handle instance resolution and creation asynchronously."""
|
|
@@ -70,6 +70,8 @@ if __name__ == "__main__":
|
|
|
70
70
|
*app.py*
|
|
71
71
|
|
|
72
72
|
```python
|
|
73
|
+
from typing import Annotated
|
|
74
|
+
|
|
73
75
|
from fastapi import FastAPI
|
|
74
76
|
|
|
75
77
|
import anydi.ext.fastapi
|
|
@@ -88,7 +90,7 @@ app = FastAPI()
|
|
|
88
90
|
|
|
89
91
|
|
|
90
92
|
@app.get("/hello")
|
|
91
|
-
def say_hello(message: str
|
|
93
|
+
def say_hello(message: Annotated[str, Inject()]) -> dict[str, str]:
|
|
92
94
|
return {"message": message}
|
|
93
95
|
|
|
94
96
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "anydi"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.39.0"
|
|
4
4
|
description = "Dependency Injection library"
|
|
5
5
|
authors = [{ name = "Anton Ruhlov", email = "antonruhlov@gmail.com" }]
|
|
6
6
|
requires-python = "~=3.9"
|
|
@@ -136,7 +136,7 @@ omit = [
|
|
|
136
136
|
]
|
|
137
137
|
|
|
138
138
|
[tool.bumpversion]
|
|
139
|
-
current_version = "0.
|
|
139
|
+
current_version = "0.39.0"
|
|
140
140
|
parse = """(?x)
|
|
141
141
|
(?P<major>0|[1-9]\\d*)\\.
|
|
142
142
|
(?P<minor>0|[1-9]\\d*)\\.
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|