Drop pre-2.35 CmdStan support in cmdstanr v1.0#1144
Conversation
Raise cmdstanr support floors and remove legacy Windows toolchain compatibility paths tied to older CmdStan versions. Core behavior updates: - Require CmdStan >= 2.35.0 across installation and path initialization flows. - Enforce version floor for install_cmdstan() inputs (version, release_url/release_file when parseable) and after archive unpack. - Reject unsupported existing installations in set_cmdstan_path()/cmdstanr_initialize(). - Keep CMDSTANR_USE_MSYS_TOOLCHAIN as deprecated/ignored with a once-per-session warning and migration guidance. Windows/toolchain cleanup: - Remove legacy MSYS/pacman/mingw32-make toolchain-install code paths. - Remove Rtools35/R3.x-specific branching and simplify toolchain path selection for current Rtools flows. R floor + compatibility cleanup: - Bump package Depends: R to >= 4.0.0. - Remove obsolete tempdir branches for R < 3.5 in code/tests. Docs and tests: - Update NEWS and install documentation, including note about using older cmdstanr releases for older CmdStan/MSYS workflows. - Add tests for archive version extraction, unsupported version rejection (including release_file and RC boundary), unsupported CMDSTAN env initialization, and ignored MSYS env warning behavior.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1144 +/- ##
==========================================
+ Coverage 87.95% 89.92% +1.96%
==========================================
Files 14 14
Lines 5935 5913 -22
==========================================
+ Hits 5220 5317 +97
+ Misses 715 596 -119 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Avoid backend-specific assumptions that caused failures on WSL - The test had expected cmdstanr_initialize() to leave PATH/VERSION NULL after rejecting an unsupported CmdStan version - On WSL CI, initialization can apparently fall back to an existing supported installation, so NULL is not guaranteed.
|
@SteveBronder @WardBrian If we require CmdStan 2.35 in cmdstanr v1.0 then I think we can simplify a lot of the Windows toolchain stuff. But I don't fully trust myself with Windows, so would be great to get your feedback if you have time. (You don't necessarily need to look at every line of code if you don't have time, but at least at a high level do these changes make sense?). |
- Scope cmdstan_default_path(dir=...) to the provided directory and avoid unrelated WSL fallback.\n- Keep Windows toolchain debug validation aligned with is_rtools4x_toolchain_usable().\n- Add a windows-2022 (R 4.1) CI-only skip flag for pareto_smooth-dependent init tests.\n- Centralize that skip logic in a shared test helper and apply it to all affected tests.\n- Harden recursive make test subprocess env and Makefile quoting for Windows reliability.
we need `posterior::pareto_smooth()`
|
This is similar to what cmdstanpy is doing in v2.0.0 (stan-dev/cmdstanpy#834) I think the simplifications you're suggesting make sense -- the main thing is just that |
Yeah. But I did also add a fallback on the Rtools side: Lines 748 to 763 in 9c579c3 and |
There was a problem hiding this comment.
Pull request overview
This PR updates cmdstanr v1.0 compatibility and initialization/toolchain logic by dropping support for CmdStan < 2.35.0 (and raising the minimum supported R version), simplifying legacy Windows/MSYS paths, and tightening path/version handling across installs and initialization.
Changes:
- Enforce CmdStan >= 2.35.0 in
install_cmdstan(),set_cmdstan_path(), andcmdstanr_initialize(); add version parsing helpers and tests. - Remove pre-R-4.0 and pre-2.35 legacy branches (tempdir handling, MSYS/Rtools35 paths) and add ABI-aware Rtools toolchain candidate selection.
- Update docs/NEWS/DESCRIPTION and extend CI and tests for the new behavior (Windows toolchain diagnostics, WSL/path state reset, recursive make test).
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/testthat/testdata/Makefile | Removes old recursive-make test Makefile (moved to resources). |
| tests/testthat/test-utils.R | Points recursive make test at new resource file; improves failure diagnostics. |
| tests/testthat/test-path.R | Adds tests for rejecting unsupported CmdStan installs and resetting cached WSL/path/version state. |
| tests/testthat/test-model-output_dir.R | Drops pre-3.5 tempdir branch; uses tempdir(check=TRUE). |
| tests/testthat/test-install.R | Removes legacy Windows/Rtools35 tests; adds tests for version parsing/floor checks and Rtools candidate selection. |
| tests/testthat/test-fit-init.R | Minor cleanup (removes stray blank line). |
| tests/testthat/resources/recursive-cmdstan-flags.mk | New makefile resource for recursive get_cmdstan_flags() test. |
| man/install_cmdstan.Rd | Updates docs to reflect new minimum CmdStan support and toolchain notes. |
| R/zzz.R | Resets cached PATH/VERSION/WSL state on invalid CMDSTAN env handling; removes pre-3.5 tempdir branch. |
| R/utils.R | Deprecates/ignores CMDSTANR_USE_MSYS_TOOLCHAIN (warn-once); simplifies make_cmd(). |
| R/path.R | Rejects unsupported CmdStan versions in set_cmdstan_path(); adds min-version helpers; resets cached WSL on unset. |
| R/install.R | Enforces minimum version for requested/latest/archive CmdStan; removes legacy MSYS toolchain paths; adds Rtools candidate logic. |
| R/args.R | Drops pre-3.5 tempdir branch; uses tempdir(check=TRUE). |
| NEWS.md | Announces CmdStan <2.35 unsupported, minimum R bump, Windows toolchain changes, env-var deprecation. |
| DESCRIPTION | Bumps minimum R to 4.0.0 and raises posterior minimum. |
| .github/workflows/R-CMD-check.yaml | Adds Windows-2022 (R 4.1) job and Windows toolchain resolution diagnostics. |
Comments suppressed due to low confidence (3)
man/install_cmdstan.Rd:73
- The generated Rd example for
release_filecontains an extra double-quote at the start (showsrelease_file=""./cmdstan-...). This should be corrected at the roxygen source so the rendered documentation shows a valid example (release_file="./cmdstan-...").
\item{release_file}{(string) A file path to a CmdStan release tar.gz file
downloaded from the releases page: \url{https://github.com/stan-dev/cmdstan/releases}.
For example: \verb{release_file=""./cmdstan-2.35.0.tar.gz"}. If \code{release_file} is
specified then both \code{release_url} and \code{version} will be ignored.}
R/install.R:601
- This comment is now inaccurate: the code checks version-specific env vars like
RTOOLS<ver>_HOME(viartools4x_home_path()) and supports multiple Rtools versions, not just “RTOOLS4X_HOME” / “RTools 40”. Updating the comment will prevent confusion when debugging toolchain detection.
# If RTOOLS4X_HOME is not set (the env. variable gets set on install)
# we assume that RTools 40 is not installed.
if (!nzchar(rtools_path)) {
R/install.R:60
- The example
release_filevalue has an extra double-quote at the beginning (release_file=""./cmdstan-...). This renders incorrectly and is not a valid example expression; it should berelease_file="./cmdstan-...".
#' downloaded from the releases page: <https://github.com/stan-dev/cmdstan/releases>.
#' For example: `release_file=""./cmdstan-2.35.0.tar.gz"`. If `release_file` is
#' specified then both `release_url` and `version` will be ignored.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@florence-bockting, when you have a chance can you test that you can use the cmdstanr from this branch on your windows computer? If possible test that |
Submission Checklist
Summary
Some of the code was developed with the help of codex. I also had it take a look at the code changes and generate this summary:
In cmdstanr v1.0 we will only support CmdStan >= 2.35.0. Users needing older CmdStan versions can install an older cmdstanr release. This simplifies legacy compatibility code and tightens behavior around version/path handling.
Main changes:
cmdstanr_initialize().
Windows/toolchain updates:
with package logic.
WSL/path state handling:
unrelated WSL CmdStan installs when an explicit dir is provided).
Compatibility/docs/tests/CI:
fallback behavior, and WSL state reset behavior.
posterior::pareto_smooth-dependent init tests only on that configuration.
Copyright and Licensing
Please list the copyright holder for the work you are submitting
(this will be you or your assignee, such as a university or company):
Jonah Gabry
By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the following licenses: