Remotes: dependency package in subdirectory of a GitHub Repo

The devtools vignette demonstrates how to specify dependencies which aren't on CRAN: Devtools dependencies

e.g.,

Imports: 
    tibble,
    ggplot2
Remotes: 
    gitlab::jimhester/covr

I'm trying to do this for a package that's not at the root of a github repository. For example, the evalcast package is in the R-packages/evalcast subdirectory of the cmu-delphi-covidcast repo: covidcast/R-packages/evalcast at main · cmu-delphi/covidcast · GitHub

It's installed via remotes with

remotes::install_github("cmu-delphi/covidcast", ref = "main",
                         subdir = "R-packages/evalcast")

But my question here - how would I include this in the DESCRIPTION under Remotes:?

I've tried all these and none work:

Remotes: github::cmu-delphi/covidcast/tree/main/R-packages/evalcast
Remotes: url::https://github.com/cmu-delphi/covidcast/tree/main/R-packages/evalcast

I'm trying to get around errors I'm running into with the standard usethis release github action, where evalcast can't be found when it's trying to install under imports. rcmdcheck works locally because I already have it installed, but CI via Github actions fails.

The GitHub Action workflow that usethis currently gives you relies on the pak package to install dependences, not remotes. Released usethis copies workflow configurations from the v1 tag in r-lib/actions: GitHub - r-lib/actions at v1-branch.

And, if memory serves, pak may not yet support as many remote specifications as remotes. There may very well be a way to specify what you want, but I don't know off the top of my head without doing further research.

Sorry that's not a definitive answer or solution, but maybe it helps you find you way to a solution.

Also note that r-lib/actions v2 is under very active development: Release v2 · r-lib/actions · GitHub.

1 Like

Here is the main documentation for how pak locates package source:

1 Like

pak does support packages in subdirectories in GitHub repos, the syntax is the same as for remotes, so you can use this with r-lib/actions and the new v2 tag:

cmu-delphi/covidcast/R-packages/evalcast

If you want to check from your R console:

❯ install.packages("pak", repos = "https://r-lib.github.io/p/pak/devel/")
❯ pak::pkg_deps("cmu-delphi/covidcast/R-packages/evalcast")
# A tibble: 115 × 32
   ref    type  direct directpkg status package version license needscompilation
   <chr>  <chr> <lgl>  <lgl>     <chr>  <chr>   <chr>   <chr>   <lgl>
 1 githu… gith… TRUE   TRUE      OK     evalca… 0.3.0   MIT + … TRUE
 2 MMWRw… stan… FALSE  FALSE     OK     MMWRwe… 0.1.3   GPL (>… FALSE
 3 Matrix stan… FALSE  FALSE     OK     Matrix  1.4-0   GPL (>… FALSE
 4 R6     stan… FALSE  FALSE     OK     R6      2.5.1   MIT + … FALSE
 5 RColo… stan… FALSE  FALSE     OK     RColor… 1.1-2   Apache… FALSE
 6 Rcpp   stan… FALSE  FALSE     OK     Rcpp    1.0.7   GPL (>… FALSE
 7 arrow  stan… FALSE  FALSE     OK     arrow   6.0.1   Apache… FALSE
 8 askpa… stan… FALSE  FALSE     OK     askpass 1.1     MIT + … FALSE
 9 asser… stan… FALSE  FALSE     OK     assert… 0.2.1   GPL-3   FALSE
10 bit64  stan… FALSE  FALSE     OK     bit64   4.0.5   GPL-2 … FALSE
# … with 105 more rows, and 23 more variables: priority <chr>, md5sum <chr>,
#   sha256 <chr>, filesize <int>, built <chr>, platform <chr>, rversion <chr>,
#   repotype <chr>, repodir <chr>, target <glue>, deps <list>, mirror <chr>,
#   sources <list>, remote <list>, error <list>, metadata <list>,
#   dep_types <list>, params <list>, sysreqs <chr>, cache_status <chr>,
#   lib_status <chr>, old_version <chr>, new_version <chr>

It however does not support GitLab repos. If you need to refer to a GitLab repo, you can use the url:: remote type, e.g.

❯ pak::pkg_deps("url::https://gitlab.com/jimhester/covr/-/archive/master/covr-master.zip")

Docs: Package sources — pak_package_sources • pak

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.