I have a package that needs to pin a maximum version for some of its dependencies. I do not plan to submit this package to CRAN, it's primarily for internal use.
A workaround is to remove any version pins from the DESCRIPTION, let pak install the dependencies from the latest versions, then downgrade the packages as needed with remotes::install_version(). See example of this strategy here.
Is this the best way to manage dependencies with maximum versions, at least for now until pak implements this feature? I'm interested in seeing other examples and solutions if anyone has found alternate strategies.
conda/mamba does a decent job at solving dependencies, but it would be ideal to not have to manually create an environment file that duplicates the package version requirements that should already be specified in the DESCRIPTION file. conda also can't handle packages outside of the conda ecosystem, while pak can handle r-universe and github repos.
Thanks @ryanzomorrodi! I was trying to avoid hard-coding a dependency version outside of the DESCRIPTION file, but I think this is the best way to do it currently.
In general, it's a really bad idea to depend on latest versions of packages, especially the external ones. This may (will) cause a lot of troubles. That's why tools like renv, conda, npm etc. have emerged long time and still exist. Rethink twice if you really want latest versions. Imagine you're rebuilding your package in three months. Many of the dependent libraries will change, some changes may be backward incompatibile and than your package is broken. Moreover, you won't be able to restore the previous working version because you haven't tracked the versions of dependencies.
@olibravo: I believe you've misunderstood my problem. I'm trying to depend on a package version that is older than the latest version (i.e. ggplot2 < 4.0.0). CRAN, pak, renv, etc are not set up well to handle that situation. In my experience, conda/mamba do a decent job of resolving dependencies in this situation, but it would be a duplication to also provide an environment yaml file alongside the DESCRIPTION file.