Skip to content

Expose renv_version parameter - #13

Merged
VincentGuyader merged 2 commits into
mainfrom
feat/expose-renv-version
May 5, 2026
Merged

Expose renv_version parameter#13
VincentGuyader merged 2 commits into
mainfrom
feat/expose-renv-version

Conversation

@VincentGuyader

Copy link
Copy Markdown
Owner

Summary

shiny2docker() is a thin wrapper over dockerfiler::dock_from_renv(). Currently every parameter of the upstream function is forwarded except renv_version — meaning a downstream caller cannot ask "use the latest renv from the configured repos" without bypassing shiny2docker().

This PR adds renv_version to the shiny2docker() signature and forwards it to dock_from_renv().

Implementation note: preserving an explicit NULL through do.call()

dock_from_renv() distinguishes three states for renv_version:

  • missing -> use the version pinned in the lockfile (default);
  • NULL -> install the latest renv from the configured repos (skips remotes);
  • a string -> install that exact version via remotes::install_version().

We must preserve all three through the wrapper. Naive forwarding fails on NULL:

# WRONG: deletes the entry from the list, dock_from_renv sees `missing`
dock_from_renv_args$renv_version <- renv_version

R's $<- and [[<- on a list with a NULL value delete the entry. The fix is single-bracket assignment with list() wrapping:

# Correct: preserves NULL as an explicit list element
dock_from_renv_args["renv_version"] <- list(renv_version)

This was caught by the new test, which would have failed (install_version still appearing in the Dockerfile, proof that NULL got dropped) without the fix.

Backward compatibility

  • renv_version is added at the end of the signature with no default. Callers that omit it get exactly the same behavior as before (lockfile version is used by dock_from_renv() via its own missing() check).
  • No new dependencies. Imports unchanged.

Test plan

  • Existing test shiny2docker works — unchanged behavior.
  • New test shiny2docker forwards renv_version to dock_from_renv — passes renv_version = NULL and asserts the Dockerfile contains no install_version call (the invariant that flips when NULL is silently dropped).
  • devtools::test() -> 11 PASS / 0 FAIL.
  • devtools::document() regenerated man/shiny2docker.Rd consistently with the new @param.
  • R CMD check clean (only environmental qpdf warning + clock NOTE on the build sandbox).

Pairs with ThinkR-open/dockerfiler#88 for the full benefit (no remotes install at all when NULL), but works on its own against the current released dockerfiler.

shiny2docker() now exposes the renv_version parameter from
dockerfiler::dock_from_renv(). Useful for downstream packages that want
to opt out of the install_version() / remotes path by passing NULL
(install the latest renv from the configured repos).

The parameter has no default: when omitted, dock_from_renv() keeps its
own default of reading the version from the renv.lock file. An explicit
renv_version = NULL is preserved through do.call() via single-bracket
list assignment ($<- and [[<- would silently drop the NULL).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR exposes renv_version on shiny2docker(), aligning the wrapper more closely with dockerfiler::dock_from_renv() so callers can control how renv is bootstrapped without bypassing this package.

Changes:

  • Added a new renv_version argument to shiny2docker() and forwarded it via do.call(), preserving explicit NULL.
  • Added a regression test covering the renv_version = NULL path.
  • Updated release notes and generated function documentation for the new parameter.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
R/shiny2docker.R Adds and forwards the new renv_version argument in the main wrapper.
tests/testthat/test-shiny2docker.R Adds coverage for forwarding renv_version = NULL.
NEWS.md Documents the new parameter in development release notes.
man/shiny2docker.Rd Regenerates the help page to include the new argument.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread R/shiny2docker.R
Comment on lines +31 to +32
#' to install the latest available renv from the configured repos
#' (faster build, no `remotes` dependency).
Comment thread NEWS.md

* `shiny2docker()` gains a `renv_version` parameter, forwarded to
`dockerfiler::dock_from_renv()`. Set to `NULL` to bootstrap with the
latest available renv (skipping the `remotes` dependency entirely).
Comment thread R/shiny2docker.R
Comment on lines +117 to +118
if (!missing(renv_version)) {
dock_from_renv_args["renv_version"] <- list(renv_version)
Address Copilot review feedback on PR #13:

- The roxygen and NEWS entries claim that 'renv_version = NULL' skips
  the 'remotes' dependency entirely. That's only true once the paired
  upstream change in dockerfiler 0.2.6 is available, so pin the floor
  in Imports rather than weaken the wording.
- Add a regression test for an explicit version string
  ('renv_version = "1.0.3"') -- the existing forwarding test only
  exercised the NULL branch, leaving the explicit-string path
  uncovered at the wrapper layer.
@VincentGuyader
VincentGuyader merged commit ece9746 into main May 5, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants