r-lib / remotes

Install R packages from GitHub, GitLab, Bitbucket, git, svn repositories, URLs
https://remotes.r-lib.org/
Other
336 stars 153 forks source link

R_BIOC_VERSION not respected in bioc_git2r_remote()? #578

Closed bbimber closed 3 years ago

bbimber commented 3 years ago

I have an R package with testing via github actions. I would like to have one test running on bioconductor release and one on devel. My workflow does a number of things:

and then my DESCRIPTION lists the Bioconductor repos without specifying a branch (since this would make it hard to test across bioc releases), such as:

Remotes: bioc::DropletUtils

This is extremely close to working as I want; however, i figured out that when remote downloads package source from the bioconductor git, it's still using release. Such as here, or here.

Is there another hook to change that? Otherwise, would it make sense for the latter to support something like:

    if (is.null(release)) {
      release <- getOption("Bioc_git_branch", "release")
    }
    if (release == "release") {
      release <- bioconductor_release()
    }

This requires two settings (the environment variable and options()), but I didnt immediately see how to effectively translate the numeric version number (which is what R_BIOC_VERSION provides) to devel/HEAD when that version is develop.

Is there some existing solution I'm missing? Thanks in advance.

bbimber commented 3 years ago

FWIW, if some hook is enabled, some code like this would work in a github workflow.

BiocManager::install(version = "${{ matrix.config.bioc }}", ask = FALSE);
cat(append = TRUE, file = "~/.Rprofile", "options(repos = BiocManager::repositories());")
cat(append = TRUE, file = "~/.Rprofile", "Sys.setenv(R_BIOC_VERSION=BiocManager::version());");
if (BiocManager::version() == BiocManager:::.version_bioc('devel')) {cat(append = TRUE, file = "~/.Rprofile", "options(Bioc_git_branch = 'devel');") }
jimhester commented 3 years ago

You should set a BiocViews: field in your DESCRIPTION, and then the Bioconductor packages will be automatically installed from the Bioconductor repositories returned by BiocManager. You generally don't need to use an explicit bioc remote unless you are developing multiple Bioconductor packages in tandem.

bbimber commented 3 years ago

@jimhester OK, I will try this. I'm not sure if I'm doing something in a sub-optimal way, but getting a non-bioconductor R package that depends on various bioconductor modules to properly install across differing bioc versions and to install with various entry points (i.e. install_deps(), install_github(), etc), has been challenging. In addition to what my package declares, I've has problems when my package depends on some other package that depends on a bioconductor package.

On another thread you posted something to the effect of "using bioc:: without specifying a branch is designed to always use bioconductor release". Running automated testing across a matrix of bioconductor releases seems like a reasonable use case, and some scheme to reliably force remotes to completely use a given bioconductor version would be really helpful.

I'm going to give your suggestion of adding BioViews a try. In parallel I think I'm going to try two other things: