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 INSTALL
installs all dependencies when installing package data, into/library
within 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 check
setup, 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.If
DESCRIPTION
has aRemotes
field, then pak does not bundle its dependencies, only emits a message that suggests usingcreate_dev_lib()
. This is because we can’t easily install from GitHub using base R functions only.When running
R CMD check
, pak usestestthat.R
to 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 intestthat.R
instead of install time is that this way we avoid the check warning about the large/library
directory.If the pak installation currently being tested does not have bundled dependencies, then
setup.R
bundles them, but into the user’s cache directory. This is to make sure that we can still usedevtools::test()
and alike for development.When developing pak interactively, e.g. using
load_all()
, usecreate_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 useinstall.packages()
source pkg from CRAN → install into/library
R CMD INSTALL
on CRAN (to build binaries) → install into/library
R CMD INSTALL
(on CRAN) forR CMD check
→ no not bundleR CMD check
→ copy into/library
, ignore errorsremotes::install_github()
withoutRemotes
→ install into/library
remotes::install_github()
withRemotes
→ no not bundledevtools::test()
and similar → copy into user’s cache directory