Skip to content
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

convert package not found errors to warnings #54

Open
friendly opened this issue Nov 5, 2024 · 1 comment
Open

convert package not found errors to warnings #54

friendly opened this issue Nov 5, 2024 · 1 comment

Comments

@friendly
Copy link

friendly commented Nov 5, 2024

Just tried get_pkgs_info on my book project and got an error for each package that renv::dependencies() discovered somewhere among the actual packages I use, even if they are just Depends: or maybe even Suggests: in a DESCRIPTION file.

I see no harm in making these warnings, and just omitting them from the result

> get_pkgs_info(out.dir = "bib")
A large number of files (1135 in total) have been discovered.
It may take renv a long time to crawl these files for dependencies.
Consider using .renvignore to ignore irrelevant files.
See `?renv::dependencies` for more information.
Set `options(renv.config.dependencies.limit = Inf)` to disable this warning.

Error in (function (pkg, lib.loc = NULL)  : 
  there is no package called ‘ggformula’
@Pakillo
Copy link
Owner

Pakillo commented Nov 14, 2024

Hi @friendly

Thanks for the report. There is a FAQ on this: https://pakillo.github.io/grateful/#error-there-is-no-package-called. The original idea was that if a package is used in scripts, it should be cited. And if it is no longer used (and installed), it should be commented out or removed from scripts (e.g. using funchir or annotater) or alternatively directly omitted from citations using the omit argument. Another option is to skip some folders for scanning packages (see https://rstudio.github.io/renv/reference/dependencies.html#ignoring-files).

But I can see how that may be tedious if there are many packages to omit or remove. I'll try to set up a new argument that gives the user the choice to skip those packages just giving a warning, not error. Although there would then be a risk that some packages might not get their citation even if they have been used in the project.

On the other hand, AFAIK renv::dependencies will only include packages called directly (i.e. using library, require, etc) and not those packages' dependencies (like those in Imports or Suggests), unless you set dependencies = TRUE (default is FALSE). So as far as I understand ggformula is called directly somewhere (maybe here?) rather than being a dependency of some other package?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants