anydi 0.56.0__py3-none-any.whl → 0.57.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: anydi
3
- Version: 0.56.0
3
+ Version: 0.57.0
4
4
  Summary: Dependency Injection library
5
5
  Keywords: dependency injection,dependencies,di,async,asyncio,application
6
6
  Author: Anton Ruhlov
@@ -116,19 +116,18 @@ if __name__ == "__main__":
116
116
  ### Inject Into Functions (`app/main.py`)
117
117
 
118
118
  ```python
119
- from anydi import Inject
119
+ from anydi import Provide
120
120
 
121
121
  from app.container import container
122
122
  from app.services import GreetingService
123
123
 
124
124
 
125
- @container.inject
126
- def greet(service: GreetingService = Inject()) -> str:
125
+ def greet(service: Provide[GreetingService]) -> str:
127
126
  return service.greet("World")
128
127
 
129
128
 
130
129
  if __name__ == "__main__":
131
- print(greet())
130
+ print(container.run(greet))
132
131
  ```
133
132
 
134
133
  ### Test with Overrides (`tests/test_app.py`)
@@ -146,7 +145,7 @@ def test_greet() -> None:
146
145
  service_mock.greet.return_value = "Mocked"
147
146
 
148
147
  with container.override(GreetingService, service_mock):
149
- result = greet()
148
+ result = container.run(greet)
150
149
 
151
150
  assert result == "Mocked"
152
151
  ```
@@ -158,8 +157,8 @@ from typing import Annotated
158
157
 
159
158
  import anydi.ext.fastapi
160
159
  from fastapi import FastAPI
161
- from anydi.ext.fastapi import Inject
162
160
 
161
+ from anydi import Provide
163
162
  from app.container import container
164
163
  from app.services import GreetingService
165
164
 
@@ -169,7 +168,7 @@ app = FastAPI()
169
168
 
170
169
  @app.get("/greeting")
171
170
  async def greet(
172
- service: Annotated[GreetingService, Inject()]
171
+ service: Provide[GreetingService]
173
172
  ) -> dict[str, str]:
174
173
  return {"greeting": service.greet("World")}
175
174
 
@@ -245,7 +244,7 @@ Wire Django Ninja (`urls.py`):
245
244
  ```python
246
245
  from typing import Annotated, Any
247
246
 
248
- from anydi import Inject
247
+ from anydi import Provide
249
248
  from django.http import HttpRequest
250
249
  from django.urls import path
251
250
  from ninja import NinjaAPI
@@ -257,7 +256,7 @@ api = NinjaAPI()
257
256
 
258
257
 
259
258
  @api.get("/greeting")
260
- def greet(request: HttpRequest, service: Annotated[GreetingService, Inject()]) -> Any:
259
+ def greet(request: HttpRequest, service: Provide[GreetingService]) -> Any:
261
260
  return {"greeting": service.greet("World")}
262
261
 
263
262
 
@@ -1,24 +1,25 @@
1
- anydi/__init__.py,sha256=Cz-beqReX0d05SFDmYcrzIs3FqQkWAwpy1Aqzd5db34,547
1
+ anydi/__init__.py,sha256=bQKzn9qfNnIMi1m3J-DdSknSDwNg8j08fdQg_-Edkto,613
2
2
  anydi/_async_lock.py,sha256=3dwZr0KthXFYha0XKMyXf8jMmGb1lYoNC0O5w29V9ic,1104
3
- anydi/_container.py,sha256=dKRT4FB0ONyEt2-MRz4T0MZziwZAMb0XyulV6lVn04g,24997
3
+ anydi/_container.py,sha256=Zdy0KtOVRlyBSblAk2MEFp13RwJkfljpB2szR5VTHQQ,22975
4
4
  anydi/_context.py,sha256=-9QqeMWo9OpZVXZxZCQgIsswggl3Ch7lgx1KiFX_ezc,3752
5
5
  anydi/_decorators.py,sha256=J3W261ZAG7q4XKm4tbAv1wsWr9ysx9_5MUbUvSJB_MQ,2809
6
+ anydi/_injector.py,sha256=IxKTh2rzMHrsW554tbiJl33Hb5sRGKYY_NU1rC4UvxE,4378
6
7
  anydi/_module.py,sha256=2kN5uEXLd2Dsc58gz5IWK43wJewr_QgIVGSO3iWp798,2609
7
8
  anydi/_provider.py,sha256=OV1WFHTYv7W2U0XDk_Kql1r551Vhq8o-pUV5ep1HQcU,1574
8
9
  anydi/_resolver.py,sha256=-MF2KsERF5qzU6uqYPF1fI58isgsjxXPLERylzFFDHE,28787
9
- anydi/_scanner.py,sha256=oycIC9kw9fsIG9qgtRHeBkj3HjmcLK0FTqWLXTLLSWE,3636
10
- anydi/_types.py,sha256=l3xQ0Zn15gRAwvBoQ9PRfCBigi2rrtSqGV-C50xXrLw,1780
10
+ anydi/_scanner.py,sha256=rbRkHzyd2zMu7AFLffN6_tZJcMaW9gy7E-lVdHLHYrs,4294
11
+ anydi/_types.py,sha256=gpanGqXjF9WQFFn62kyIod6m1dE97vV-L2u2Y2nWie8,2933
11
12
  anydi/ext/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
13
  anydi/ext/django/__init__.py,sha256=Ve8lncLU9dPY_Vjt4zihPgsSxwAtFHACn0XvBM5JG8k,367
13
- anydi/ext/fastapi.py,sha256=FflFBdK-moyv9Vsfem4NyNt8jgPwFLweeCl5cfU0Iks,2348
14
- anydi/ext/faststream.py,sha256=dJPInvi0JUx-SS8H4aBRl3u-PAW6S_TqqfxVOl3D1L0,1929
15
- anydi/ext/pydantic_settings.py,sha256=0GQjw7QpQlT5p6GxFClXYdtc6J42PClmAnRWPEzMjvY,1488
16
- anydi/ext/pytest_plugin.py,sha256=Es1K1S6_2gIdTUYkbw2d1aZcHnjJutGFafVsLPGcVJc,4684
14
+ anydi/ext/fastapi.py,sha256=8kXdO6RPwRbPyUh6YirdEPE-clJKXE--n-TAYI2hZf8,2326
15
+ anydi/ext/faststream.py,sha256=XT80r1FGL-xlU7r8urm9sNpUfl4OPMJseW4dade_fR4,1836
16
+ anydi/ext/pydantic_settings.py,sha256=jVJZ1wPaPpsxdNPlJj9yq282ebqLZ9tckWpZ0eIwWLg,1533
17
+ anydi/ext/pytest_plugin.py,sha256=M54DkA-KxD9GqLnXdoCyn-Qur2c44MB6d0AgJuYCZ5w,16171
17
18
  anydi/ext/starlette/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
19
  anydi/ext/starlette/middleware.py,sha256=MxnzshAs-CMvjJp0r457k52MzBL8O4KAuClnF6exBdU,803
19
20
  anydi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
21
  anydi/testing.py,sha256=cHg3mMScZbEep9smRqSNQ81BZMQOkyugHe8TvKdPnEg,1347
21
- anydi-0.56.0.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
22
- anydi-0.56.0.dist-info/entry_points.txt,sha256=AgOcQYM5KyS4D37QcYb00tiid0QA-pD1VrjHHq4QAps,44
23
- anydi-0.56.0.dist-info/METADATA,sha256=JkjqRSFZ-Vu22IYLnWS2uRTZA7uUbX41o2b-51yp0dA,6561
24
- anydi-0.56.0.dist-info/RECORD,,
22
+ anydi-0.57.0.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
23
+ anydi-0.57.0.dist-info/entry_points.txt,sha256=AgOcQYM5KyS4D37QcYb00tiid0QA-pD1VrjHHq4QAps,44
24
+ anydi-0.57.0.dist-info/METADATA,sha256=w3aIoTTCQHgCRT1X-JnQ_VrEUz1hUl--PcktWO8fw2M,6534
25
+ anydi-0.57.0.dist-info/RECORD,,
File without changes