rstudio / packrat

Packrat is a dependency management system for R
http://rstudio.github.io/packrat/
401 stars 89 forks source link

Implement a dependency-free install_github #65

Open kevinushey opened 10 years ago

kevinushey commented 10 years ago

The tricky bits:

  1. Handling authentication (for installing from private repos),
  2. Handling pull requests (need to communicate with GitHub API to map pull request numbers to refs),
  3. ...without any package dependencies.

We might be able to use some command line tools here; ie, even if we can't use RCurl we can maybe still use curl.

jjallaire commented 10 years ago

I think we can have a more narrow scope than devtools::install_github in order to ensure that this doesn't take too much time. Let's discuss realtime later, but I think for the packrat use case we don't need support for pull requests at all.

The problem with using command line tools is that they vary by platform (none on windows, curl on mac, wget on linux). The downloader package navigates this: http://cran.r-project.org/web/packages/downloader/index.html (however we already include a copy of the downloader code in packrat!).

krlmlr commented 10 years ago

How about install_github <- function(...) with_extlib("devtools", install_github(...)) -- and add devtools to the list of suggested packages? In interactive mode, even installation of devtools could be offered -- to the user's library, outside of packrat. Anything else sounds like a lot of duplicated effort to me...

jjallaire commented 10 years ago

Our plan is to eventually move all of the installation related functions from devtools into packrat (and then have devtools just alias them from packrat) so the effort would be duplicative only for a period of time.

On Thu, Jun 5, 2014 at 11:09 AM, Kirill Müller notifications@github.com wrote:

How about install_github <- function(...) with_extlib("devtools", install_github(...)) -- and add devtools to the list of suggested packages? In interactive mode, even installation of devtools could be offered -- to the user's library, outside of packrat. Anything else sounds like a lot of duplicated effort to me...

— Reply to this email directly or view it on GitHub https://github.com/rstudio/packrat/issues/65#issuecomment-45231502.

cderv commented 5 years ago

I think remotes::install_github is the dependency free install_github that was wished a few years ago.

tools::package_dependencies("remotes", recursive = TRUE)
#> $remotes
#> [1] "methods" "utils"
dchiu911 commented 5 years ago

Hi @kevinushey

I tried to snapshot a public GitHub package, but it failed with the previously observed error:

Error in snapshotSources(project, activeRepos(project), allRecordsFlat) : 
  Errors occurred when fetching source files:
Error in getSourceForPkgRecord(pkgRecord, sourceDir, availablePkgs, repos) : 
  Failed to download package from URL:
- "api.github.com/repos/AlineTalhouk/splendid/tarball/2ef9cc638dfec19a9e0bc4693c1e9d0affc332f2"

I found some help at https://github.com/rstudio/packrat/issues/447#issuecomment-360739671 (even though that was for a private repo). The snapshot worked after I installed devtools, even though I already had remotes installed. Perhaps the condition here should be relaxed/modified to use remotes to reduce the number of dependencies one needs.

kevinushey commented 5 years ago

What version of Packrat are you using? It seems strange that there is no https:// prefixed on that URL.

IIUC this should've been fixed in the development version of Packrat: https://github.com/rstudio/packrat/commit/f3c7e0d79169301da119a27bf12356f6ac94fe14

dchiu911 commented 5 years ago

Thanks, I am using the CRAN release 0.5.0, will let you know if the devel doesn't resolve.