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

Feature Request: Consider adding ability to generate a renv lockfile from log #161

Open
parmsam-pfizer opened this issue Feb 14, 2023 · 7 comments
Labels
enhancement New feature or request release 0.3.0

Comments

@parmsam-pfizer
Copy link
Collaborator

Feature Idea

Consider adding ability to create a renv lockfile from the log file or along with log file creation (at time of aexecture()). This would allow users to more easily recreate the environment that was originally used.

Relevant Input

Relevant Output

No response

Reproducible Example/Pseudo Code

No response

@parmsam-pfizer parmsam-pfizer added the enhancement New feature or request label Feb 14, 2023
@parmsam-pfizer parmsam-pfizer changed the title Feature Request: consider adding ability to generate a renv lockfile from log Feature Request: Consider adding ability to generate a renv lockfile from log Feb 14, 2023
@bms63
Copy link
Collaborator

bms63 commented Feb 14, 2023

omg this would be amazing!!

@parmsam-pfizer
Copy link
Collaborator Author

I'd love to help out with this feature. Submitting another issue (#162) to parse/filter a log file. This could be associated with that issue.

@parmsam-pfizer
Copy link
Collaborator Author

After more thought and tinkering with renv lockfiles, maybe generating a DESCRIPTION file from log would be a more flexible alternative. {renv} does pull package version from the DESCRIPTION file if its available in an R project: https://rstudio.github.io/renv/reference/install.html?q=description#project-description-files
Any thoughts on this approach instead?

@bms63
Copy link
Collaborator

bms63 commented Feb 15, 2023

Interesting, so it makes a sort of pseudo-package for you? So if you used 4 packages in the your Script, then A Description Files generated by logrx would be generated with those 4 as Imports. Would suggest have all the packages in the environment but not used?

@parmsam-pfizer
Copy link
Collaborator Author

It could be like a compendium DESCRIPTION file (based on Karthik's talk at RStudio Conf 2019 that I recently saw). We could maybe add the packages in the environment as suggests like you said.

@bms63
Copy link
Collaborator

bms63 commented Jun 12, 2023

  • To investigate to see if feasible.
  • renv might not be the solution

@parmsam
Copy link

parmsam commented Sep 20, 2023

Revisiting this today. As of renv 1.0.0, they added lockfile_* family of functions. Experimented with it and it looks like we can now generate renv lockfiles on the fly without needing to initialize a renv project (via init()). Including example code below. Will still need to confirm it is doing what we might need.

library(renv)

lock_file <- "pkg.lock"

x <- renv::lockfile_create(
  type = "custom",
  packages = c("dplyr", "stringr")
)

renv::lockfile_write(
  lockfile = x,
  file = lock_file,
  type = "custom",
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request release 0.3.0
Projects
Status: 📋 Backlog
Development

No branches or pull requests

3 participants