pkgdepends
pkgdepends copied to clipboard
Handling of package dependency constraints ==, <= and <
This is a follow-up of https://github.com/r-lib/remotes/issues/376 after having been referred to pak
and as such indirectly also pkgdepends
.
I'm considering the following "artificial" package testdeps
:
Type: Package
Package: testdeps
Title: Handling Package Dependency Specification
Version: 0.0.1
Authors@R: person("Martin", "Studer", "[email protected]", c("aut", "cre"))
Description: Testing handling of package dependency specifications.
License: MIT
Imports:
abind,
biogas (>= 1.9.0),
coop (> 0.4-0),
deal (== 1.2-35),
effsize (<= 0.7.0),
face (< 0.1-4)
I have an environment established as follows:
install.packages("devtools")
devtools::install_github("r-lib/pkgdepends")
dir.create("libdir1")
.libPaths(c("libdir1", .libPaths()))
remotes::install_version("biogas", "1.8.0")
remotes::install_version("coop", "0.4-0")
remotes::install_version("deal", "1.2-37")
remotes::install_version("effsize", "0.7.1")
remotes::install_version("face", "0.1-5")
dir.create("libdir2")
.libPaths(c("libdir2", .libPaths()))
- A
.libPaths()
in the orderlibdir2
,libdir1
, ... -
libdir1
contains some of the package dependencies but with versions not matching the constraints oftestdeps
- of special interest are the dependenciesdeal
,effsize
andface
which use dependency constraints==
,<=
and<
-
libdir2
is an empty library directory at the top of.libPaths()
I now use pkgdepends
to attempt to solve the dependencies for testdeps
in the following way:
r <- pkgdepends::remotes()$new("deps::.", library = .libPaths()[1])
r$solve(policy = "lazy")
- above
DESCRIPTION
file present in current working directory - using
.libPaths()[1]
, i.e.libdir2
as the library directory
This results in the following output:
ℹ Checking for package metadata updates
✔ All 6 metadata files are current.
✔ Loading session disk cached package metadata
✔ Using cached package metadata
PKG FAILED SOLUTION, 0 refs, resolved in 85ms, solved in 19ms ─────────────────
* Cannot install `deps::.`.
- Cannot install dependency deal
* Cannot install `deps::.`.
- Cannot install dependency effsize
* Cannot install `deps::.`.
- Cannot install dependency face
I would have expected this to give a solution since libdir2
is empty and it is theoretically possible for deal
, effsize
and face
to be installed with appropriate versions without affecting any existing installations of those packages (which are installed in libdir1
). A failure seems reasonable if package installation would result in loss of existing installations but that's not the case in this example.
Where is the testdeps package?
I just built a DESCRIPTION
for illustration purposes. I basically just have a folder with that file.
I have the same problem for a number of internal packages, that I'm testing out with pkgdepends. We're using hard version dependencies (== and =>), and pgkdepends seems to give incorrect resolution errors.
We cannot properly implement this for CRAN (and Bioconductor) packages currently, because their metadata does not contain information about older package versions. To gather all the metadata from the package files in the CRAN archive is very tedious currently. E.g. for something like effsize (<= 0.7.0)
we would need to download all previous versions of the package to look up their dependencies.