Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Get package info for packages in a specific library #88

Open
nbenn opened this issue Jul 29, 2023 · 4 comments
Open

Get package info for packages in a specific library #88

nbenn opened this issue Jul 29, 2023 · 4 comments
Labels
feature a feature request or enhancement tidy-dev-day 🤓 Tidyverse Developer Day rstd.io/tidy-dev-day

Comments

@nbenn
Copy link

nbenn commented Jul 29, 2023

In a setting where I have two package libraries, one with sessioninfo (and its dependencies) installed (A) and another (B) with an arbitrary set of packages installed (which might include some packages that are also included in A, but potentially in differing versions), I would now like to run sessioninfo::package_info(pkgs = "installed") but only on library B.

This distinction between "host" library (A) and "client" library (B) currently is unsupported because lib.loc passed on to utils::packageDescription() is fixed to .libPaths() in

desc <- lapply(pkgs$package, pkg_desc, lib.loc = .libPaths())

Would you be open to maybe exposing this as an argument to sessioninfo::package_info()? Or is this besides the point for what sessioninfo is intended to provide? This might also require some thought as to what this means exactly for pkgs != "installed", and flags "P" and "V".

@gaborcsardi
Copy link
Member

We can have a library argument that defaults to .libPaths().

The question is whether this breaks the cases where a dependency is not available in the prescribed library libraries.

@gaborcsardi gaborcsardi added the feature a feature request or enhancement label Jul 31, 2023
@nbenn
Copy link
Author

nbenn commented Jul 31, 2023

I started putting something together that does exactly this: main...nbenn:sessioninfo:main

However what you're pointing out is exactly the issue that comes next: "session info" is about how package library/ies behave under the current session. What I am ultimately after is something slightly different: "what would session_info() give in a (new) session with .libPaths() settings that are different from the session where the session_info() call originates from".

Maybe (if you're interested) I should back up a step. And if not, I understand: this might move away from what sessioninfo is about.

In a CI/CD setting I recently ran into the a situation where I had conflicting package requirements between the set of packages responsible for "running" the CI/CD workflow than for the "content" itself.

Such a conflict, in principle, could be resolved by setting up two libraries, one for all packages that are used in CI/CD and one for the dependencies of the package being checked. For a step involving rcmdcheck::rcmdcheck(), all is fine (please correct me if I'm wrong): I start the check from one process where rcmdcheck (and its dependencies) are installed but pass a libpath value pointing to the library where the package dependencies are installed.

Looking at other packages typically involved in such a workflow, I started with sessioninfo. But with current capabilities I could not make it work in the way of rcmdcheck.

Separating out the code that needs to be run in the "child" process (a couple of calls to base functions) from the code responsible for presentation, wich is the part that comes with dependencies (such as cli) seems straightforward. Maybe, for turning on this behavior, session_info() could gain an argument new_session = FALSE? But I'm getting ahead of myself. For now the main question is: do you think something like this is in-scope for sessioninfo and might provide a worthwhile addition?

@gaborcsardi
Copy link
Member

In a CI/CD setting I recently ran into the a situation where I had conflicting package requirements between the set of packages responsible for "running" the CI/CD workflow than for the "content" itself.

Can you share some details?

@gaborcsardi gaborcsardi added the tidy-dev-day 🤓 Tidyverse Developer Day rstd.io/tidy-dev-day label Jul 17, 2024
@tanho63
Copy link

tanho63 commented Aug 15, 2024

Reviewing as part of tidy-dev-day: I think what you want here is pak::lib_status(lib = .libPaths()[1]) etc. Recommend closing.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
feature a feature request or enhancement tidy-dev-day 🤓 Tidyverse Developer Day rstd.io/tidy-dev-day
Projects
None yet
Development

No branches or pull requests

3 participants