Skip to content

progress

Helper functions for tracking the progress of long-running operations.

Functions:

Name Description
track_iterable_progress

Track the progress of an iterable.

track_iterable_progress 🔗

track_iterable_progress(iterable: Iterable[T], /, *, description: str) -> Iterator[T]

Track the progress of an iterable.

This function is a helper that creates a progress bar and tracks the progress of an iterable. It's useful for tracking the progress of a long-running operation, such as generating the brag document.

Source code in src/brag/progress.py
def track_iterable_progress[T](
    iterable: Iterable[T],
    /,
    *,
    description: str,
) -> Iterator[T]:
    """Track the progress of an iterable.

    This function is a helper that creates a progress bar and tracks the progress of
    an iterable. It's useful for tracking the progress of a long-running operation,
    such as generating the brag document.
    """
    with _progress_bar(description=description) as progress:
        yield from progress.track(iterable)