Progress Utils

GitHub Link to Code.

Progress control utilities for progress bar handling.

Provides a central toggle to enable or disable tqdm-based progress bars without touching environment variables or external programs. The controller is accessed by managers to keep progress handling consistent within this process.

class mdxplain.utils.progress_utils.ProgressUtils

Toggle and wrap progress bar rendering.

Uses an internal flag to enable or disable tqdm progress bars. This avoids side effects on the environment and allows runtime updates through the pipeline configuration.

classmethod set_enabled(enabled: bool) None

Enable or disable progress bars globally within this process.

Parameters

enabledbool

Flag to control progress bar visibility.

Returns

None

Progress bar state is updated for subsequent calls.

Examples

>>> ProgressUtils.set_enabled(False)
classmethod iterate(iterable: Iterable[T], **kwargs) Iterator[T]

Wrap an iterable with tqdm respecting the current enable flag.

Parameters

iterableIterable

Sequence or generator to wrap with a progress bar.

kwargs

Additional tqdm keyword arguments (e.g., desc, total, unit).

Returns

Iterator

Iterator that yields from the input iterable, optionally showing a bar.

Examples

>>> for i in ProgressUtils.iterate(range(3), desc="Work"):
...     pass