Cache 'CRAN'-Like Metadata and R Packages

Metadata and package cache for CRAN-like repositories. This is a utility package to be used by package management tools that want to take advantage of caching.


lifecycle CRANstatus Travis buildstatus AppVeyor buildstatus Coveragestatus

Metadata and package cache for CRAN-like repositories. This is a utility package to be used by package management tools that want to take advantage of caching.

Installation

You can install the released version of pkgcache from CRAN with:

install.packages("pkgcache")

Metadata cache

meta_cache_list() lists all packages in the metadata cache. It includes Bioconductor package, and all versions (i.e. both binary and source) of the packages for the current platform and R version.

library(pkgcache)
meta_cache_list()
#> ✔ Using cached package metadata
#> # A tibble: 32,705 x 33
#>    package title version depends suggests built imports archs repodir
#>    <chr>   <chr> <chr>   <chr>   <chr>    <chr> <chr>   <chr> <chr>  
#>  1 A3      "Acc… 1.0.0   R (>= … randomF… R 3.… <NA>    <NA>  bin/ma…
#>  2 abbyyR  Acce… 0.5.4   R (>= … testtha… R 3.… httr, … <NA>  bin/ma…
#>  3 abc.da… Data… 1.0     R (>= … <NA>     R 3.… <NA>    <NA>  bin/ma…
#>  4 ABC.RAP Arra… 0.9.0   R (>= … knitr, … R 3.… graphi… <NA>  bin/ma…
#>  5 abc     Tool… 2.1     R (>= … <NA>     R 3.… <NA>    <NA>  bin/ma…
#>  6 ABCana… Comp… 1.2.1   R (>= … <NA>     R 3.… plotrix <NA>  bin/ma…
#>  7 abcdeF… "ABC… 0.4     Rglpk,… LIM,syb… R 3.… <NA>    <NA>  bin/ma…
#>  8 ABCopt… Impl… 0.15.0  <NA>    testtha… R 3.… Rcpp, … ABCo… bin/ma…
#>  9 ABCp2   Appr… 1.2     MASS    <NA>     R 3.… <NA>    <NA>  bin/ma…
#> 10 abcrf   Appr… 1.7.1   R(>= 3… <NA>     R 3.… "readr… abcr… bin/ma…
#> # … with 32,695 more rows, and 24 more variables: platform <chr>,
#> #   rversion <chr>, needscompilation <chr>, priority <chr>, ref <chr>,
#> #   type <chr>, direct <lgl>, status <chr>, target <chr>, mirror <chr>,
#> #   sources <list>, filesize <int>, sha256 <chr>, sysreqs <chr>,
#> #   published <dttm>, deps <list>, license <chr>, linkingto <chr>,
#> #   enhances <chr>, license_restricts_use <chr>, os_type <chr>,
#> #   license_is_foss <chr>, md5sum <chr>, path <chr>

meta_cache_deps() and meta_cache_revdeps() can be used to look up dependencies and reverse dependencies.

The metadata is updated automatically if it is older than seven days, and it can also be updated manually with meta_cache_update().

See the cranlike_metadata_cache R6 class for a lower level API, and more control.

Package cache

Package management tools may use the pkg_cache_* functions and in particular the package_cache class, to make use of local caching of package files.

The pkg_cache_* API is high level, and uses a user level cache:

pkg_cache_summary()
#> $cachepath
#> [1] "/Users/gaborcsardi/Library/Caches/R-pkg/pkg"
#> 
#> $files
#> [1] 12
#> 
#> $size
#> [1] 553116
pkg_cache_list()
#> # A tibble: 12 x 8
#>    fullpath       path        package   url  etag sha256    built vignettes
#>    <chr>          <glue>      <chr>   <int> <int> <chr>     <lgl> <chr>    
#>  1 /Users/gaborc… src/contri… cranca…    NA    NA 936fa23d… FALSE <NA>     
#>  2 /Users/gaborc… src/contri… cranca…    NA    NA 936fa23d… TRUE  FALSE    
#>  3 /Users/gaborc… src/contri… rcmdch…    NA    NA 6332ddc2… FALSE <NA>     
#>  4 /Users/gaborc… src/contri… rcmdch…    NA    NA 6332ddc2… TRUE  FALSE    
#>  5 /Users/gaborc… src/contri… revdep…    NA    NA e204aede… FALSE <NA>     
#>  6 /Users/gaborc… src/contri… revdep…    NA    NA e204aede… TRUE  FALSE    
#>  7 /Users/gaborc… src/contri… cranca…    NA    NA 936fa23d… FALSE <NA>     
#>  8 /Users/gaborc… src/contri… cranca…    NA    NA 936fa23d… TRUE  FALSE    
#>  9 /Users/gaborc… src/contri… revdep…    NA    NA e204aede… FALSE <NA>     
#> 10 /Users/gaborc… src/contri… revdep…    NA    NA e204aede… TRUE  FALSE    
#> 11 /Users/gaborc… src/contri… rcmdch…    NA    NA 6332ddc2… FALSE <NA>     
#> 12 /Users/gaborc… src/contri… rcmdch…    NA    NA 6332ddc2… TRUE  FALSE
pkg_cache_find(package = "dplyr")
#> # A tibble: 0 x 8
#> # … with 8 variables: fullpath <chr>, path <glue>, package <chr>,
#> #   url <int>, etag <int>, sha256 <chr>, built <lgl>, vignettes <chr>

pkg_cache_add_file() can be used to add a file, pkg_cache_delete_files() to remove files, pkg_cache_get_files() to copy files out of the cache.

The package_cache class provides a finer API.

Bioconductor support

Both the metadata cache and the package cache support Bioconductor by default, automatically. The following options and environment variables can be used to configure pkgcache’s Bioconductor support:

Options:

  • The BioC_mirror option can be used to select a Bioconductor mirror. This takes priority over the R_BIOC_MIRROR environment variable.

Environment variables:

  • The R_BIOC_VERSION environment variable can be used to override the default Bioconductor version detection and force a given version. E.g. this can be used to force the development version of Bioconductor.
  • The R_BIOC_MIRROR environment variable can be used to select a Bioconductor mirror. The BioC_mirror option takes priority over this, if set.

Code of Conduct

Please note that the ‘pkgcache’ project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

License

MIT © RStudio Inc

News

pkgcache 1.0.4

  • Fix handling of Bioconducor versions and repositories, see README for the details.

  • Now different versions of pkgcache, that potentially have different metadata format, can share the same metadata cache directory.

pkgcache 1.0.3

  • Fix concurrency issues when the async API is used multiple times in the same event loop.

  • Make package compatible with tibble >= 2.0.0.

  • Add meta_cache_summary() and a summary() method for cranlike_metadata_cache. Return information about a metadata cache instance.

pkgcache 1.0.2

  • First public release

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("pkgcache")

1.0.5 by Gábor Csárdi, 5 months ago


https://github.com/r-lib/pkgcache#readme


Report a bug at https://github.com/r-lib/pkgcache/issues


Browse source code at https://github.com/cran/pkgcache


Authors: Gábor Csárdi [aut, cre]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports assertthat, cli, cliapp, curl, crayon, digest, filelock, glue, prettyunits, R6, rappdirs, rematch2, rlang, tibble, tools, utils, uuid, withr

Suggests callr, covr, debugme, desc, fs, jsonlite, mockery, pingr, rprojroot, testthat


Imported by pak.


See at CRAN