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

Add vignette on generating lockfile from log #233

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

parmsam-pfizer
Copy link
Collaborator

@parmsam-pfizer parmsam-pfizer commented Feb 13, 2025

Thank you for your Pull Request!

We have developed a Pull Request template to aid you and our reviewers. Completing the below tasks helps to ensure our reviewers can maximize their time on your code as well as making sure the logrx codebase remains robust and consistent.

The spirit of logrx

While many packages to facilitate the logging of code already exist in the R ecosystem, it is hard to find a solution that works well for clinical programming applications. Many logging implementations are more implicit and rely on user input to create the log for the execution of a script. While this is useful for logging specific events of an application, in clinical programming a log has a set purpose.

logrx is built around the concept of creating a log for the execution of an R script that provides an overview of what happened as well as the environment that it happened in. We set out to create a flexible logging utility that could provide the necessary information to anyone reviewing the code execution so they can recreate the execution environment and run the code for themselves. Please make sure your Pull Request meets this spirit of logrx.

Please check off each taskbox as an acknowledgment that you completed the task. This checklist is part of the Github Action workflows and the Pull Request will not be merged into the dev branch until you have checked off each task.

  • The spirit of logrx is met in your Pull Request
  • Code is formatted according to the tidyverse style guide
  • Updated relevant unit tests or have written new unit tests. Remember to remove any configured log objects at the end of every test using log_remove().
  • Creation/updates to relevant roxygen headers and examples.
  • Run devtools::document() so all .Rd files in the man folder and the NAMESPACE file in the project root are updated appropriately
  • Run pkgdown::build_site() and check that all affected examples are displayed correctly and that all new functions occur on the "Reference" page.
  • Update NEWS.md if the changes pertain to a user-facing function (i.e. it has an @export tag) or documentation aimed at users (rather than developers)
  • Address any updates needed for vignettes and/or templates
  • Run R CMD check locally and address all errors and warnings - devtools::check()
  • Link the issue so that it closes after successful merging. - fixes Feature Request: Consider adding ability to generate a renv lockfile from log #161
  • Address all merge conflicts and resolve appropriately
  • Pat yourself on the back for a job well done! Much love to your accomplishment!

@parmsam-pfizer parmsam-pfizer self-assigned this Feb 13, 2025
@parmsam-pfizer parmsam-pfizer marked this pull request as ready for review February 13, 2025 17:29
@parmsam-pfizer
Copy link
Collaborator Author

parmsam-pfizer commented Feb 20, 2025

Not sure if I need to add renv into the suggests section of the DESCRIPTION file. It's used in the vignette. Any thoughts @bms63 @nicholas-masel @thomasp-b @kodesiba?

Run options(crayon.enabled = TRUE)
── R CMD build ─────────────────────────────────────────────────────────────────
pdflatex not found! Not building PDF manual.
* checking for file ‘.../DESCRIPTION’ ... OK
* preparing ‘logrx’:
* checking DESCRIPTION meta-information ... OK
* installing the package to build vignettes
* creating vignettes ... ERROR
Error: --- re-building ‘approved.Rmd’ using rmarkdown
--- finished re-building ‘approved.Rmd’
--- re-building ‘execution.Rmd’ using rmarkdown
--- finished re-building ‘execution.Rmd’
--- re-building ‘generate-lockfile.Rmd’ using rmarkdown
Quitting from lines [20](https://github.com/pharmaverse/logrx/actions/runs/13313538018/job/37181842469?pr=233#step:9:21)-24 [setup] (generate-lockfile.Rmd)
Error: Error: processing vignette 'generate-lockfile.Rmd' failed with diagnostics:
there is no package called 'renv'
--- failed re-building ‘generate-lockfile.Rmd’
--- re-building ‘logrx.Rmd’ using rmarkdown
--- finished re-building ‘logrx.Rmd’
--- re-building ‘options.Rmd’ using rmarkdown
--- finished re-building ‘options.Rmd’
SUMMARY: processing the following file failed:
  ‘generate-lockfile.Rmd’
Error: Error: Vignette re-building failed.
Execution halted
Error: Error in proc$get_built_file() : Build process failed
Calls: <Anonymous> ... build_package -> with_envvar -> force -> <Anonymous>
Execution halted
Error: Process completed with exit code 1.

@parmsam-pfizer
Copy link
Collaborator Author

Resolved based on short discussion on this in today's meeting.

Avoid saying logfile and say log file instead. Keeping lockfile that same.
@parmsam-pfizer
Copy link
Collaborator Author

Spell check failing due to "renv" and "lockfile" words which are used properly. That check for this PR can be ignored or maybe we can add those terms into the whitelist.

Run insightsengineering/r-spellcheck-action@v3
Run options(repos = c(CRAN = "https://cloud.r-project.org/"))
Loading required package: spelling
Run cd .
DESCRIPTION does not contain 'Language' field. Defaulting to 'en-US'.
  WORD       FOUND IN
lockfile   generate-lockfile.Rmd:2,52
renv       generate-lockfile.Rmd:2,52

Number of misspelled words: 2
You may correct the spellings of the words above or add them to the "inst/WORDLIST" file by running spelling::update_wordlist()
Error: Process completed with exit code 2.

add renv and lockfile into wordlist to pass spell checks
@bms63
Copy link
Collaborator

bms63 commented Feb 21, 2025

So interesting these are passing now @kodesiba

@parmsam-pfizer
Copy link
Collaborator Author

Made a bunch of fixes last night, @bms63.

packages = used_pgks$package_name
)

renv::lockfile_write(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@parmsam-pfizer might be excessive but will this just record packages with the latest version or also the versions used? wasn't sure if that was even doable with this method or if we'd have to go all the way to an install and then lockfile create approach to capture that information.

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

Successfully merging this pull request may close these issues.

Feature Request: Consider adding ability to generate a renv lockfile from log
3 participants