rstantools icon indicating copy to clipboard operation
rstantools copied to clipboard

Auto-format Stan models during rstan_config()?

Open andrjohns opened this issue 2 years ago • 5 comments

When running the reverse-dependency checks for rstan 2.31 with the stanc3 branch for erroring on expired deprecations, the majority of dependencies are failing (mostly due to the array syntax).

Rather than requiring another extensive round of patches and submission delays, should we just run the stanc auto-formatter during the rstan_config() call? We can then also be opening issues and contacting the relevant maintainers to say that they should be updating their models, but the actual update could still progress in the interim.

Note that there's still some discussion on when the deprecations should be made into warnings, but it's still worth putting a plan together early.

Tagging the relevant players for input: @hsbadr @jgabry @bgoodri

andrjohns avatar Mar 30 '23 13:03 andrjohns

should we just run the stanc auto-formatter during the rstan_config() call?

We can handle this automatically in the experimental version of RStan by defaulting stanc.auto_format option to TRUE. However, this may affect the line numbers in debugging and error messages.

hsbadr avatar Mar 31 '23 07:03 hsbadr

I don't think we should do it rstan itself, otherwise it might end up stopping users from updating their syntax (if they don't receive any warnings or errors)

andrjohns avatar Mar 31 '23 07:03 andrjohns

@jgabry based on your experiences with CRAN, if we update stanc to properly emit a warning during package installation for deprecated syntax (causing R CMD CHECK failures for downstream packages), would this irk CRAN or be considered appropriate for motivating maintainers to update their packages?

andrjohns avatar Apr 01 '23 11:04 andrjohns

if we update stanc to properly emit a warning during package installation for deprecated syntax

And to clarify that I was thinking this would only be added after 2.31 is on CRAN (assuming the 2.26 -> 2.31 transition is minimal)

andrjohns avatar Apr 01 '23 11:04 andrjohns

Rather than requiring another extensive round of patches and submission delays, should we just run the stanc auto-formatter during the rstan_config() call? We can then also be opening issues and contacting the relevant maintainers to say that they should be updating their models, but the actual update could still progress in the interim.

I like this idea, but I might be overlooking a reason not to do this. @bgoodri What do you think?

@jgabry based on your experiences with CRAN, if we update stanc to properly emit a warning during package installation for deprecated syntax (causing R CMD CHECK failures for downstream packages), would this irk CRAN or be considered appropriate for motivating maintainers to update their packages?

If I understand correctly, your idea of running the auto-formatter in rstantools would avoid this, right? If we don't auto-format but still add a warning to stanc that causes failures in ~100 packages then that would likely be frowned upon by CRAN even if we technically comply with their policy of giving developers enough advance notice. That said, if we give developers time to update their packages and they choose not to, at some point that's on them and not on us and we'd be in compliance with CRAN policy, so we could maybe push forward anyway. Not ideal, but a possibility.

jgabry avatar Apr 01 '23 20:04 jgabry