stan-dev / rstanarm

rstanarm R package for Bayesian applied regression modeling
https://mc-stan.org/rstanarm
GNU General Public License v3.0
385 stars 132 forks source link

Request: move `shinystan` from `Imports` to `Suggests`? #623

Open etiennebacher opened 4 months ago

etiennebacher commented 4 months ago

Summary:

rstanarm imports shinystan, meaning that all packages that import rstanarm (or suggest it and install the suggested packages in CI) also have to install a whole lot of shiny-related packages. This can cause issues in CI and for other package maintainers.

Description:

Hello, I don't use rstanarm but I maintain a package that Suggests it (datawizard). Recently, there were some failures in CI due to installation errors for QuickJSR. I was a bit intrigued because our package has nothing to do with Javascript and doesn't use any shiny-related packages. It turned out that QuickJSR was installed because shinystan is also installed, and that's because we suggest rstanarm:

pak::pkg_deps_explain("datawizard", "QuickJSR", dependencies = TRUE)
#> ℹ Loading metadata database✔ Loading metadata database ... done
#> datawizard -> brms -> rstan -> QuickJSR
#> datawizard -> rstanarm -> rstan -> QuickJSR
#> datawizard -> rstanarm -> shinystan -> rstan -> QuickJSR

(note that QuickJSR is also installed by rstan but this encouraged me to open this issue)

As I said before, I never used rstanarm before but it seems to me that shinystan isn't so important here. From what I can see shinystan is only imported to provide a method for objects of class stanreg. However, this doesn't require importing shinystan, suggesting it would be enough using s3_register() (see in particular the section "Usage in other packages").

I didn't find a trivial way to compute how many mandatory dependencies would be removed if shinystan was moved from Imports to Suggests, but I'd assume this number is quite high given all the dependencies of shiny that would no longer need to be installed.

library(deepdep)

dd <- deepdep("rstanarm", depth = 2)
plot_dependencies(dd)

Is this something you would consider?

Reproducible Steps:

N/A

RStanARM Version:

2.32.1

R Version:

4.4.0

Operating System:

Windows 10 x64 (build 19045)