The embedded library
pak bundles its dependencies into the installed package, or into the user’s cache directory. This can happen several ways:
If not running inside
R CMD check,
R CMD INSTALLinstalls all dependencies when installing package data, into
/librarywithin the installed package. Downloading and installing the (currently) 37 dependencies takes about 1-1.5 minutes for platforms with binaries, and about 4 minutes for platforms that compile everything from source (measured on Linux). The goal of this is to create self-contained binaries on CRAN.
The main advantage of doing this in the data step is that we can show the progress and/or other messages to the user.
If the bundling fails, pak errors. This is to avoid creating a non-functional binary package. Hopefully CRAN will just try creating the binary again, later.
This also works well on platforms that do not (yet) have binaries, e.g. M1 macs, Linux or the new experimental Windows platform.
When running inside
R CMD check, pak does not bundle its dependencies, to make the checks faster.
Unlike the traditional
R CMD checksetup, CRAN does not install the package during the check. Instead, they pre-install it, and then refer to the install log in the check. They do set up the same env vars for the pre-install, so pak still does not bundle the dependencies in this case.
When pak is installed from GitHub, using
remotes::install_github()or similar, the same dependency bundling happens. This is nice on platforms for which we do not build a self-contained binary. But see also the next item.
Remotesfield, then pak does not bundle its dependencies, only emits a message that suggests using
create_dev_lib(). This is because we can’t easily install from GitHub using base R functions only.
R CMD check, pak uses
testthat.Rto bundle the dependencies into the temporary installation that is used in the check. However, pak copies the dependencies in this case, to make the check faster. If copying the dependencies fails, then pak skips the test suite. The reason for copying in
testthat.Rinstead of install time is that this way we avoid the check warning about the large
If the pak installation currently being tested does not have bundled dependencies, then
setup.Rbundles them, but into the user’s cache directory. This is to make sure that we can still use
devtools::test()and alike for development.
When developing pak interactively, e.g. using
create_dev_lib()to copy dependencies into the user’s cache directory.
In summary, these are the various bundling modes:
install.packages()binary pkg from CRAN → pak is ready to use
install.packages()source pkg from CRAN → install into
R CMD INSTALLon CRAN (to build binaries) → install into
R CMD INSTALL(on CRAN) for
R CMD check→ no not bundle
R CMD check→ copy into
/library, ignore errors
Remotes→ install into
Remotes→ no not bundle
devtools::test()and similar → copy into user’s cache directory