-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
interoperability with R and renv
#55
Comments
self tag sessionInfo() @chainsawriot |
My suggestion for the guesstimation #53 would be to use it if pkg and/or snapshot is missing. Snapshot also only makes sense if material_dir is not missing? Or of course if pkg is something else than a vector of packages |
@schochastics Probably like this:
I am still not so sure whether we should make |
I think Otherwise I think the table is good |
I think you'd be better off using My expectation is that in the cases where you use rang, you'd going to need to do a little checking afterwards (because you're original state is likely to be a mix of packages installed on different dates), so that IMO the goal of |
hmm maybe I am missing something but the default behavior of |
I think using project directories is table stakes for reproducibility. |
totally agree! |
@chainsawriot just realized |
@schochastics You are right that My concern is #57. We haven't implemented the complete specification of pkgrefs. https://r-lib.github.io/pkgdepends/reference/pkg_refs.html If we really need to implement the complete spec. of pkgrefs, ## guesstimate; make `paths_as_local_packages` default to FALSE
resolve(pkgs = ".", paths_as_local_packages = FALSE) #default
resolve(pkgs = c(".", "~/anotherdirectory")) ## scan two directories
## interpret paths as local packages
resolve(pkgs = ".", paths_as_local_packages = TRUE)
resolve(pkgs = c(".", "~/anotherdirectory"), paths_as_local_packages = TRUE)
resolve(pkgs = "local::.", paths_as_local_packages = TRUE)
resolve(pkgs = c("local::.", "~/anotherdirectory"), paths_as_local_packages = FALSE) |
This looks sensible to me. |
The |
I will start experimenting a bit |
first idea. renv also creates an S3 object called as_pkgrefs.renv_lockfile <- function(x, ...){
sources <- vapply(lockfile[["Packages"]],`[[`,character(1),"Source",USE.NAMES = FALSE)
pkgs <- c()
if("Repository"%in%sources){
pkgs <- c(pkgs, paste0("cran::",vapply(lockfile[["Packages"]][sources=="Repository"],`[[`,character(1),"Package",USE.NAMES = FALSE)))
}
if("Bioconductor"%in%sources){
pkgs <- c(pkgs,paste0("bioc::",vapply(lockfile[["Packages"]][sources=="Bioconductor"],`[[`,character(1),"Package",USE.NAMES = FALSE)))
}
if("GitHub"%in%sources){
pkgs <- c(pkgs,
paste0("github::",
vapply(lockfile[["Packages"]][sources=="GitHub"],`[[`,character(1),"RemoteUsername",USE.NAMES = FALSE),"/",
vapply(lockfile[["Packages"]][sources=="GitHub"],`[[`,character(1),"Package",USE.NAMES = FALSE))
)
}
pkgs
}
f <- "renv.lock"
cat(readLines(f),sep = "\n")
#> {
#> "R": {
#> "Version": "4.2.2",
#> "Repositories": [
#> {
#> "Name": "CRAN",
#> "URL": "https://cloud.r-project.org"
#> }
#> ]
#> },
#> "Packages": {
#> "BiocGenerics": {
#> "Package": "BiocGenerics",
#> "Version": "0.44.0",
#> "Source": "Bioconductor",
#> "git_url": "https://git.bioconductor.org/packages/BiocGenerics",
#> "git_branch": "RELEASE_3_16",
#> "git_last_commit": "d7cd9c1",
#> "git_last_commit_date": "2022-11-01",
#> "Hash": "0de19224c2cd94f48fbc0d0bc663ce3b",
#> "Requirements": []
#> },
#> "levelnet": {
#> "Package": "levelnet",
#> "Version": "0.5.0",
#> "Source": "GitHub",
#> "RemoteType": "github",
#> "RemoteHost": "api.github.com",
#> "RemoteRepo": "levelnet",
#> "RemoteUsername": "schochastics",
#> "RemoteRef": "HEAD",
#> "RemoteSha": "775cf5e91b83cb73fe35e378ed1d7facb1d741eb",
#> "Hash": "29eed562ec1c9bb7e31ce87e321b9252",
#> "Requirements": [
#> "Matrix",
#> "Rcpp",
#> "igraph"
#> ]
#> },
#> "rtoot": {
#> "Package": "rtoot",
#> "Version": "0.3.0",
#> "Source": "Repository",
#> "Repository": "CRAN",
#> "Hash": "06eb72de42a3f8fcb252badc58f92b2b",
#> "Requirements": [
#> "clipr",
#> "curl",
#> "dplyr",
#> "httr",
#> "jsonlite",
#> "tibble"
#> ]
#> }
#> }
#> }
lockfile <- jsonlite::fromJSON(f, simplifyVector = FALSE)
class(lockfile) <- "renv_lockfile"
as_pkgrefs.renv_lockfile(lockfile)
#> [1] "cran::rtoot" "bioc::BiocGenerics"
#> [3] "github::schochastics/levelnet" Created on 2023-02-24 with reprex v2.0.2 |
|
I guess we need to display a warning when |
add support for renv lockfiles (#55)
I am gonna try to work on the remainder of this issue, specifically the table and #55 (comment) |
@schochastics Given the current implementation, this case resolve(pkgs = c(".", "~/anotherdirectory")) ## scan two directories Should not be considered as scanning? I was thinking, maybe we don't need that Single directory, no |
@chainsawriot hmm maybe for directories it actually makes sense to allow multiple scanning? I just went with the same as for lock files. Happy to change this behaviour if you think allowing to scan multiple directories at once is a desirable feature |
@schochastics I was thinking a possible use case. For example, I have two material dirs. And therefore, I might want to scan the two dirs. But the issue is, transferring two dirs into the Docker image is not possible with the current If we allow multiple scanning here, we should somehow also allow |
@chainsawriot Then maybe lets implement both "vectorized". I can do that. Question is: this version or next? |
@schochastics Next ver. I think we have enough features on our plate already. |
@chainsawriot working on the export to renv lockfile. Do you know where the hash value comes from? It is optional, but I'd try to include it |
@schochastics I didn't know. But a bit of UTSL indicates it is a hash of the DESCRIPTION file after As we don't have access to all DESCRIPTION files, maybe we should keep this optional. Unless you want to implement a strict mode that will download the DESCRIPTION files and hash them accordingly. Current ver. CRAN packages have it available. https://cran.r-project.org/web/packages/rtoot/DESCRIPTION Archive ver. I need to figure out, but it is just downloading the tarball. (d2e34f9) bioc, I don't know whether we can just hash a section of the big DESCRIPTION file. GH and local (in the making) is probably straight forward. |
hmm I'll think about it but I think for now i will leave the hash for the future. |
@schochastics With #57 , i.e. |
Doing another coding round tonight so will work it in |
@schochastics For this and #53 , the last thing to do is to make "." the default of |
It's done. Thank you @schochastics for implementing this; and @hadley for the comments. |
The
pkgs
argument ofresolve()
should accept:sessionInfo()
- should this even be the default?renv::dependencies
Guesstimate packages and snapshot date for current directory? #53- For this,
snapshot_date
should use another default, whenmissing
. maybe the newest file.mtime, as @hadley suggested.The
rang
S3 object should be exportable as:The text was updated successfully, but these errors were encountered: