Skip to content

Commit 2e60447

Browse files
committed
Merge branch 'release/0.1.1'
2 parents e1daef5 + 7cce6f1 commit 2e60447

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ fastapi's handler function.
2323
I have a script called `test_script.py` so my app can be found at `test_script:app`.
2424
We use strings to resolve application to bypass circular imports.
2525

26+
Also, as you can see, we use `TaskiqDepends` for Request. That's because
27+
taskiq dependency resolver must know that this type must be injected. FastAPI disallow
28+
Depends for Request type. That's why we use `TaskiqDepends`.
29+
2630
```python
2731
from fastapi import FastAPI, Request
2832
from pydantic import BaseModel
@@ -73,6 +77,8 @@ async def app_shutdown():
7377
taskiq_fastapi.init(broker, "test_script:app")
7478

7579

80+
# We use TaskiqDepends here, becuase if we use FastAPIDepends fastapi
81+
# initilization will fail.
7682
def get_redis_pool(request: Request = TaskiqDepends()) -> ConnectionPool:
7783
return request.app.state.redis_pool
7884

@@ -81,6 +87,9 @@ def get_redis_pool(request: Request = TaskiqDepends()) -> ConnectionPool:
8187
async def my_redis_task(
8288
key: str,
8389
val: str,
90+
# Here we depend using TaskiqDepends.
91+
# Please use TaskiqDepends for all tasks to be resolved correctly.
92+
# Or dependencies won't be injected.
8493
pool: ConnectionPool = TaskiqDepends(get_redis_pool),
8594
):
8695
async with Redis(connection_pool=pool) as redis:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "taskiq-fastapi"
33
description = "FastAPI integration for taskiq"
44
authors = ["Taskiq team <taskiq@no-reply.com>"]
55
maintainers = ["Taskiq team <taskiq@no-reply.com>"]
6-
version = "0.1.0"
6+
version = "0.1.1"
77
readme = "README.md"
88
license = "LICENSE"
99
classifiers = [

0 commit comments

Comments
 (0)