fastapi-progress 0.1.1__tar.gz → 0.1.2__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.
- {fastapi_progress-0.1.1 → fastapi_progress-0.1.2}/PKG-INFO +1 -1
- {fastapi_progress-0.1.1 → fastapi_progress-0.1.2}/pyproject.toml +1 -1
- {fastapi_progress-0.1.1 → fastapi_progress-0.1.2}/src/fastapi_progress/context.py +1 -0
- {fastapi_progress-0.1.1 → fastapi_progress-0.1.2}/src/fastapi_progress/core.py +1 -0
- {fastapi_progress-0.1.1 → fastapi_progress-0.1.2}/src/fastapi_progress/decorators.py +1 -0
- {fastapi_progress-0.1.1 → fastapi_progress-0.1.2}/README.md +0 -0
- {fastapi_progress-0.1.1 → fastapi_progress-0.1.2}/src/fastapi_progress/__init__.py +0 -0
- {fastapi_progress-0.1.1 → fastapi_progress-0.1.2}/src/fastapi_progress/globals.py +0 -0
- {fastapi_progress-0.1.1 → fastapi_progress-0.1.2}/src/fastapi_progress/py.typed +0 -0
- {fastapi_progress-0.1.1 → fastapi_progress-0.1.2}/src/fastapi_progress/state/__init__.py +0 -0
- {fastapi_progress-0.1.1 → fastapi_progress-0.1.2}/src/fastapi_progress/state/base.py +0 -0
- {fastapi_progress-0.1.1 → fastapi_progress-0.1.2}/src/fastapi_progress/state/memory.py +0 -0
- {fastapi_progress-0.1.1 → fastapi_progress-0.1.2}/src/fastapi_progress/state/redis.py +0 -0
|
@@ -6,6 +6,7 @@ current_task_id: ContextVar[str | None] = ContextVar("current_task_id", default=
|
|
|
6
6
|
|
|
7
7
|
class Progress:
|
|
8
8
|
async def update(self, progress: int, message: str = "", metadata: dict[str, Any] | None = None) -> None:
|
|
9
|
+
# Updates task progress
|
|
9
10
|
task_id = current_task_id.get()
|
|
10
11
|
if task_id:
|
|
11
12
|
backend = get_backend()
|
|
@@ -5,6 +5,7 @@ from .globals import set_backend, get_backend
|
|
|
5
5
|
from .state.base import StateBackend
|
|
6
6
|
|
|
7
7
|
def init_progress(app: FastAPI, backend: StateBackend | None = None, prefix: str = "/ws/progress") -> None:
|
|
8
|
+
# Injects WebSocket route into FastAPI
|
|
8
9
|
if backend:
|
|
9
10
|
set_backend(backend)
|
|
10
11
|
|
|
@@ -9,6 +9,7 @@ P = ParamSpec("P")
|
|
|
9
9
|
R = TypeVar("R")
|
|
10
10
|
|
|
11
11
|
def track_progress(task_id_param: str | None = None) -> Callable[[Callable[P, Coroutine[Any, Any, R]]], Callable[P, Coroutine[Any, Any, R]]]:
|
|
12
|
+
# Tracks background task progress
|
|
12
13
|
def decorator(func: Callable[P, Coroutine[Any, Any, R]]) -> Callable[P, Coroutine[Any, Any, R]]:
|
|
13
14
|
@wraps(func)
|
|
14
15
|
async def wrapper(*args: P.args, **kwargs: P.kwargs) -> R:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|