Docker progress
docker_progress
¶
Defines helpers for parsing Docker Compose's plain-progress output stdout lines
Why
-
When
docker compose pull/upruns with its output piped, it emits one line per progress update (e.g.abc123 Downloading [===> ] 2MB/50MB) instead of updating layer rows in place -
Rendering those lines into rich's
Tableor flet'sListViewgrows these objects out of bounds and makes output unreadable
How It Works
This module classifies each output line piped from a Docker Compose command so that a front-end can collapse them by layer id and colour them by status, approaching Docker's native console display
No Presentation Here
-
This module only classifies lines
-
Each front-end maps the returned
kindto its own palette and renders the collapsed layers however it likes
LineKind = Literal['done', 'active', 'idle', 'free']
module-attribute
¶
The category of a streamed line
A Docker layer that is done / active / idle, or any other free line
classify(line)
¶
Classifies a streamed output line for collapsing and colouring
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
line
|
str
|
A single line of streamed subprocess output |
required |
Returns:
| Type | Description |
|---|---|
LineKind
|
A |
str | None
|
/ |
tuple[LineKind, str | None]
|
collapse it under. For any other line, |