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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: fastapi-progress
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Zero-config background task progress tracker for FastAPI using WebSockets.
5
5
  Author: Aldair Andrade
6
6
  Author-email: Aldair Andrade <demianmaster2003@gmail.com>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fastapi-progress"
3
- version = "0.1.1"
3
+ version = "0.1.2"
4
4
  description = "Zero-config background task progress tracker for FastAPI using WebSockets."
5
5
  readme = "README.md"
6
6
  authors = [
@@ -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: