pkgcache-package {pkgcache}R Documentation

Cache for package data and metadata

Description

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.

Details

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.

(We load the pillar package, because it makes the pkgcache data frames print nicer, similarly to tibbles.)

library(pkgcache)
library(pillar)
meta_cache_list()
#> # A data frame: 41,440 x 32
#>    package  version depends  suggests  license imports  linkingto archs enhances
#>    <chr>    <chr>   <chr>    <chr>     <chr>   <chr>    <chr>     <chr> <chr>   
#>  1 A3       1.0.0   R (>= 2~ randomFo~ GPL (>~ <NA>     <NA>      <NA>  <NA>    
#>  2 AATtools 0.0.1   R (>= 3~ <NA>      GPL-3   magritt~ <NA>      <NA>  <NA>    
#>  3 ABACUS   1.0.0   R (>= 3~ rmarkdow~ GPL-3   ggplot2~ <NA>      <NA>  <NA>    
#>  4 ABC.RAP  0.9.0   R (>= 3~ knitr, r~ GPL-3   graphic~ <NA>      <NA>  <NA>    
#>  5 ABCanal~ 1.2.1   R (>= 2~ <NA>      GPL-3   plotrix  <NA>      <NA>  <NA>    
#>  6 ABCoptim 0.15.0  <NA>     testthat~ MIT + ~ Rcpp, g~ Rcpp      ABCo~ <NA>    
#>  7 ABCp2    1.2     MASS     <NA>      GPL-2   <NA>     <NA>      <NA>  <NA>    
#>  8 ABHgeno~ 1.0.1   <NA>     knitr, r~ GPL-3   ggplot2~ <NA>      <NA>  <NA>    
#>  9 ABPS     0.3     <NA>     testthat  GPL (>~ kernlab  <NA>      <NA>  <NA>    
#> 10 ACA      1.1     R (>= 3~ <NA>      GPL     graphic~ <NA>      <NA>  <NA>    
#> # ... with 41,430 more rows, and 23 more variables: os_type <chr>,
#> #   priority <chr>, license_is_foss <chr>, license_restricts_use <chr>,
#> #   repodir <chr>, rversion <chr>, platform <chr>, needscompilation <chr>,
#> #   ref <chr>, type <chr>, direct <lgl>, status <chr>, target <chr>,
#> #   mirror <chr>, sources <list>, filesize <dbl>, sha256 <chr>, sysreqs <chr>,
#> #   built <chr>, published <dttm>, deps <list>, 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/org.R-project.R/R/pkgcache/pkg"
#> 
#> $files
#> [1] 1482
#> 
#> $size
#> [1] 1610749135
pkg_cache_list()
#> # A data frame: 1,482 x 11
#>    fullpath  path   package  url   etag  sha256 version platform built vignettes
#>    <chr>     <chr>  <chr>    <chr> <chr> <chr>  <chr>   <chr>    <int>     <int>
#>  1 /Users/g~ archi~ <NA>     http~ "W/\~ 96c17~ <NA>    <NA>        NA        NA
#>  2 /Users/g~ bin/m~ plogr    http~ "\"3~ 2b195~ 0.2.0   aarch64~    NA        NA
#>  3 /Users/g~ src/c~ RMariaDB http~ "\"d~ c9176~ 1.2.1   source      NA        NA
#>  4 /Users/g~ bin/m~ RMariaDB http~ "\"2~ 1483f~ 1.2.0   aarch64~    NA        NA
#>  5 /Users/g~ src/c~ remotes  <NA>   <NA> fcad1~ <NA>    <NA>         0        NA
#>  6 /Users/g~ bin/m~ archive  http~ "\"1~ 5a6c0~ 1.1.3   aarch64~    NA        NA
#>  7 /Users/g~ src/c~ prompt   http~ "\"2~ 13cd8~ 1.0.1   source      NA        NA
#>  8 /Users/g~ bin/m~ assertt~ http~ "\"a~ d3c8b~ 0.2.0   x86_64-~    NA        NA
#>  9 /Users/g~ bin/m~ cli      http~ "\"4~ 15c3c~ 1.0.0   x86_64-~    NA        NA
#> 10 /Users/g~ bin/m~ crayon   http~ "\"a~ 1cca1~ 1.3.4   x86_64-~    NA        NA
#> # ... with 1,472 more rows, and 1 more variable: rversion <chr>
pkg_cache_find(package = "dplyr")
#> # A data frame: 4 x 11
#>   fullpath  path   package url     etag  sha256 version platform built vignettes
#> * <chr>     <chr>  <chr>   <chr>   <chr> <chr>  <chr>   <chr>    <int>     <int>
#> 1 /Users/g~ src/c~ dplyr   https:~ "\"d~ d2fe3~ 1.0.7   source      NA        NA
#> 2 /Users/g~ bin/m~ dplyr   https:~ "\"5~ ae115~ 0.8.5   x86_64-~    NA        NA
#> 3 /Users/g~ bin/m~ dplyr   https:~ "\"6~ 93f35~ 1.0.7   x86_64-~    NA        NA
#> 4 /Users/g~ bin/m~ dplyr   https:~ "\"1~ c7fac~ 1.0.7   x86_64-~    NA        NA
#> # ... with 1 more variable: rversion <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. See the BioC_mirror option and the R_BIOC_MIRROR and R_BIOC_VERSION environment variables below to configure Bioconductor support.

Package Options

Package environment variables

Using pkgcache in CRAN packages

If you use pkgcache in your CRAN package, please make sure that

This is to make sure that pkgcache does not modify the user’s files while running ⁠R CMD check⁠.

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 (c) RStudio Inc

Author(s)

Maintainer: Gábor Csárdi csardi.gabor@gmail.com

See Also

Useful links:


[Package pkgcache version 2.0.1 Index]