# What changed The ahead R package (version 0.38.1) and its Python wrapper now install much faster because almost every heavy modeling dependency was moved out of Imports and into Suggests. Prior releases pulled in two dozen modeling packages at install time, which made installs slow even if you planned to use only one forecasting method. The new approach keeps only the minimal packages required at load time as Imports: Rcpp (>= 1.0.6), foreach, and tseries. Everything else lives in Suggests and is installed only when needed.
# Why this matters ahead supports many forecasting methods that rely on different modeling packages (forecast, randomForest, glmnet, e1071, vars, fGarch, VineCopula, mboost, ranger, ForecastComb, and others). When those were in Imports, R installed them all before the package could load. Moving them to Suggests reduces initial install time to the few core packages the package actually needs to load.
# How runtime installation works A small internal helper, check_suggested(), is used by functions that require a suggested package. Its behavior is straightforward:
- If the package is missing and the session is interactive, the helper asks permission before installing.
- If the session is non-interactive (scripts, CI), it installs automatically.
- If installation fails, the helper stops with an explicit instruction showing the exact install.packages(...) command and includes CRAN and Techtonique's r-universe repositories for packages not available on CRAN.
That means calling ahead::dynrmf(..., fit_func = randomForest::randomForest) for the first time in a fresh environment triggers installation of randomForest only then. After that one-time install, the package is available for all subsequent calls.
# Effect on the Python wrapper
# Practical implications for users
- Faster installs: install.packages("ahead") is now quick because only Rcpp, foreach, and tseries are required at install/load time.
- Predictable runtime behavior: if you call a method that requires an external package, the helper will either prompt or install it automatically depending on whether the session is interactive.
- Clear failure messages: when installation cannot proceed, the error includes the exact command to run and points to both CRAN and the r-universe repository that hosts some dependencies (e.g., ForecastComb, misc).
# How to adapt If you want to avoid being prompted or to pre-install backends expected in your workflows, install the modeling packages you plan to use ahead of time. In non-interactive environments (CI, production scripts), missing suggested packages will be installed automatically the first time they are required.
# Bottom line The new dependency arrangement makes ahead lighter to install and keeps the convenience of automatic, on-demand installation for the forecasting backends you actually use. This improves developer and user workflows by reducing upfront installation time while preserving method flexibility.