pak icon indicating copy to clipboard operation
pak copied to clipboard

Download only subdirectory for GitHub packages when appropriate

Open jashapiro opened this issue 1 year ago • 3 comments

When installing a package from GitHub where the package is in a subdirectory of the main repository, pak::pkg_install() downloads the entire repository. For some repositories this may be a non-issue, but if the repository is large (and the R package is only a small part of the repository), this may result in a long, slow download.

Might it be possible to implement a sparse-checkout or equivalent to reduce downloads and improve install times in this situation?

jashapiro avatar Oct 10 '24 20:10 jashapiro

Try a git:: remote, that possibly already does a sparse checkout.

It is hard to do a sparse checkout for github:: because there is no good way in the GH API to do that.

gaborcsardi avatar Oct 11 '24 10:10 gaborcsardi

It does not seem that the git:: remotes in pak allow subdirectories? I did test whether remotes::install_git with a subdirectory specified used a sparse checkout, but it does not seem to.

jashapiro avatar Oct 11 '24 14:10 jashapiro

Or rather, maybe a sparse checkout isn't quite what I want, as that seems to still download the whole .git folder, which can be large.

jashapiro avatar Oct 11 '24 15:10 jashapiro