Pin managed Python to a known-good version (default 3.12) - #10
Merged
Merged
Conversation
simple_python() now pins the managed miniconda environment's interpreter
rather than letting reticulate pick, which on a fresh install can be a
bleeding-edge Python (e.g. 3.14) that key packages have no wheels for yet.
- New python_version arg (NULL -> options(nat.python.python_version) ->
pre-set RETICULATE_MINICONDA_PYTHON_VERSION -> "3.12"; NA to defer).
- resolve_python_version() encodes the precedence; set the env var only
for the duration of provisioning (restored on exit) and pass it to
conda_create().
- An existing env at another version is kept, not silently rebuilt, with
a warning pointing at simple_python("cleanenv").
- CI provision step passes python_version= per matrix leg and asserts the
provisioned interpreter matches; first leg renamed py-shipped-default.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A bare `else` on its own line parses as an error at Rscript top level (the `if` statement is already complete on the preceding line). Use the braced form. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
py_discover_config()$version can be a numeric_version; nzchar() tolerates it but startsWith() errors on a non-character. Coerce to character and guard length/NA/empty before the comparison. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10 +/- ##
==========================================
- Coverage 66.66% 64.27% -2.40%
==========================================
Files 6 6
Lines 495 529 +34
==========================================
+ Hits 330 340 +10
- Misses 165 189 +24 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A user recently got a fresh miniconda install on Python 3.14.7 (reticulate's uv-based auto-init grabs the newest CPython when nothing constrains it), then had to tear it all down and redo at 3.12 because key packages had no 3.14 wheels yet.
simple_python()uses the managed miniconda path, which already defaults to 3.12 in reticulate 1.46 — but that default was implicit and unpinned. This makes it explicit and controllable.What
python_versionargument onsimple_python(). Resolution precedence: explicit arg →options(nat.python.python_version)→ a pre-setRETICULATE_MINICONDA_PYTHON_VERSION→ built-in default"3.12".NA/""means "don't pin, defer to reticulate".resolve_python_version()encodes that precedence;simple_python_base()setsRETICULATE_MINICONDA_PYTHON_VERSIONonly for the duration of provisioning (restored viaon.exit) and passespython_versiontoconda_create().simple_python("cleanenv").python_version=per matrix leg and asserts the provisioned interpreter matches the request; the shipped-default leg (renamedpy-shipped-default) exercises the 3.12 pin.Tests
New
resolve_python_versiontests cover the precedence chain and the NA/empty/bad-length cases. Full suite: 0 fail / 0 warn / 0 skip. Roxygen regenerated clean.🤖 Generated with Claude Code