Skip to main content

Module progress

Module progress 

Source
Expand description

Progress displays.

Port of rich/progress.py’s display and task model: a grid of tasks, one row each, whose cells come from a list of ProgressColumns, laid out as upstream’s make_tasks_table does: a Table::grid with padding=(0, 1), each column’s table-column options, and expand.

Time is read from an injectable clock (Progress::clock, upstream’s get_time), so elapsed time, speed, ETA and spinner frames are deterministic under test. The default clock is monotonic.

Progress::start runs the display live on the Live refresh thread (LiveProgress); LiveProgress::track and track port track(). TextColumn format strings use pyformat.

transient and disable apply to the live display; LiveProgress::wrap_read and LiveProgress::open port wrap_file and open.

Re-exports§

pub use crate::console::GetTime;

Structs§

BarColumn
A progress bar column’s width and styles. Port of BarColumn’s arguments.
LiveProgress
A running Progress display. Task changes made through it are picked up by the next refresh, as with upstream’s refresh=False updates.
Progress
A progress display over one or more Tasks. Mirrors rich.progress.Progress.
ProgressReader
A reader that advances a task by the bytes read through it. Returned by LiveProgress::wrap_read and LiveProgress::open (upstream _Reader).
SpinnerColumn
An animated spinner. Port of SpinnerColumn: one spinner shared by every row, whose animation starts at its first render.
Task
A single tracked task. Mirrors rich.progress.Task; read-only outside Progress.
TaskId
Identifies a task within one Progress. Upstream’s TaskID.
TaskUpdate
Changes for Progress::update; unset fields are left alone. Upstream’s keyword arguments to Progress.update.
TextColumn
A text cell built from a format string. Port of TextColumn: the format is expanded against the task as text_format.format(task=task), so it can use any task attribute ({task.completed}, {task.percentage:>3.0f}) and per-task fields ({task.fields[name]}).
TimeRemainingColumn
Estimated time remaining. Port of TimeRemainingColumn, including its half-second render cache (max_refresh = 0.5).
Track
The iterator LiveProgress::track returns.
TrackStdout
The iterator track returns; it owns its live display.

Enums§

ProgressColumn
A column in a Progress display. Mirrors upstream’s ProgressColumns.

Functions§

track
Track progress over iter with a live display on stdout. Port of the module-level rich.progress.track: the description, bar, progress and time-remaining columns, refreshed ten times a second, stopped when the iterator is exhausted or dropped.