r-lib / pak

A fresh approach to package installation
https://pak.r-lib.org
646 stars 57 forks source link

Consider packages listed in remotes as dependencies #496

Open hadley opened 1 year ago

hadley commented 1 year ago

Currently, remotes only modifies where a package is installed from. It would be nice if it would just install the package if listed (but presumably there's some reason we don't already do this?)

gaborcsardi commented 1 year ago

IDK what the original reason was in devtools. It would make sense to allow this, although it is a change of behavior.

OTOH I am not sure if there are a lot of benefits. For a package, you probably also want to list the package in Imports or Suggests, because otherwise R CMD check fails if you use the dependency in the package. And if you only need it in special circumstances, e.g. for pkgdown, we already have a Config/Needs field for that.

hadley commented 1 year ago

IIRC remotes currently only affects the packages directly listed in Imports etc; not their dependencies. Maybe that's the fix I actually want?

And maybe it would be useful to have a message or warning about remotes that are ignored?

krlmlr commented 1 year ago

IIUC, Remotes: now works like a Config/Needs/* field that is always consulted. Should that be documented in https://pak.r-lib.org/reference/package-dependency-types.html?

FWIW, the behavior of the "Remotes" field is as documented in https://pak.r-lib.org/reference/pak_package_sources.html#the-remotes-field.

I used the following to enforce installation of a binary version of {digest}:

Suggests: 
    digest
Remotes:
    digest@0.6.31

I had to add it to "Suggests" too. I wish there was an easier way to request packages (all or some) to be installed from binary only.

gaborcsardi commented 1 year ago

IIUC, Remotes: now works like a Config/Needs/* field that is always consulted. Should that be documented in pak.r-lib.org/reference/package-dependency-types.html?

I am not sure what you mean. Nothing has changed in Remotes. That man page is about the dependencies arguments.

To install all packages from binary, you need to set the pkg.platforms option to pak::system_r_platform(). There is no way to install one package from binary, but binary packages are used by default if you specify upgrade = FALSE.