progress
FreeBodyEngine.build.progress
#
A minimal, dependency-free single-line terminal progress indicator for
the build pipeline. Two modes: determinate (a real 0..100% bar, for stages
where the total unit of work is known, e.g. bundling N asset files) and
indeterminate (an animated spinner, for stages like pip install/
PyInstaller where no real completion fraction is ever knowable). Only one
line is ever live on screen - each stage overwrites the previous one with
a carriage return rather than scrolling the terminal.
ProgressBar(enabled=None)
#
A single live status line for the build pipeline - see module docstring.
enabled defaults to whether stdout is a real terminal
(isatty()) - disabled automatically when output is redirected to a
file or pipe, where carriage-return-driven line overwriting would
just produce garbled output.
BAR_WIDTH = 30
class-attribute
instance-attribute
#
SPINNER_FRAMES = '|/-\\'
class-attribute
instance-attribute
#
SPIN_INTERVAL = 0.1
class-attribute
instance-attribute
#
enabled = sys.stdout.isatty() if enabled is None else enabled
instance-attribute
#
done(label=None)
#
Finalizes the current stage - the line is kept (not overwritten by the next stage's first render) so a scroll-back history of completed stages remains readable.
fail(message)
#
Reports a failure for the current stage and stops any spinner animation.
stage(label, total=None)
#
Starts a new stage. total=None renders an indeterminate spinner;
otherwise a real percentage bar driven by update().
update(current, total=None)
#
Advances a determinate stage's progress.