$ show futureverse/progressr
The progressr package provides a minimal, unifying API for reporting progress updates in R. It separates progress signaling (developer-controlled) from progress presentation (end-user controlled) using R's condition system. Developers create progressor functions to signal updates, while end users configure handlers to determine how progress is displayed (terminal, GUI, audio, notifications, or file-based). The architecture centers around a handler plugin system where `with_progress()` manages context and handler state. Key features include integration with parallel frameworks (future, furrr, plyr), Shiny compatibility via `withProgressShiny()`, and a global progression handler for R ≥ 4.0.0. The package emphasizes flexibility—handlers can be mixed and matched, progress reporting can be suppressed, and updates work seamlessly in iterative and parallel contexts. Software engineering rigor is evident through an extensive test suite (50+ test scripts in `inst/testme/`), continuous integration, semantic versioning, and comprehensive vignettes. The design avoids tight coupling—core components like `progressor()`, `with_progress()`, and `progress_aggregator()` are isolated and reusable. While dependencies on optional packages (cli, progress, beepr, etc.) introduce some maintenance complexity, the core remains stable and well-maintained with recent activity.
The LLM identified 4 files worth highlighting for reuse:
Creates a progressor function that signals progress updates via R's condition system. This isolated component enables decoupled progress reporting and can be extracted with minimal modification—only requiring base R. Demonstrates reusable signaling pattern where developers focus solely on emitting updates without presentation concerns.
Manages progress reporting context by temporarily setting handlers and global progression handlers. Uses `withCallingHandlers` for safe condition catching and cleanup. This reusable context manager pattern handles entry/exit logic, option scoping, and handler stacking—easily adaptable for other temporary state management scenarios.
Combines multiple progressor functions into a single progressor that updates all components. This utility enables nested progress reporting (e.g., outer loop progress + inner loop progress) through functional composition. The implementation is self-contained, depends only on progressor creation, and showcases reusable combination patterns for modular progress tracking.
Factory function for creating standardized progress handlers that accept progression conditions and perform side effects (e.g., update progress bars, play sounds). Encourages reuse by abstracting handler boilerplate—developers only need to implement the presentation logic. This pattern reduces duplication and ensures consistent handler interfaces across different output modalities.