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

Render for correct output in weigh() #281

Merged
merged 2 commits into from
Jan 28, 2025
Merged

Render for correct output in weigh() #281

merged 2 commits into from
Jan 28, 2025

Conversation

juliasilge
Copy link
Member

Addresses #280

I used rmarkdown::render() directly here, after building the package locally. I am very mystified about what might be going on here!

@@ -133,7 +133,7 @@ weigh(small_lm)
#> # A tibble: 25 × 2
#> object size
#> <chr> <dbl>
#> 1 terms 8.06
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the substantive change, i.e. the current wrong output being shown in our rendered README.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the callout!

Copy link
Contributor

@simonpcouch simonpcouch left a comment

Choose a reason for hiding this comment

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

This is sooo strange and I also don't have a good sense of what's happening here!🫣

I imagined my 6-months-from-now-self would likely devtools::build_readme() without thinking about it, so I wondered if we could detect when we're evaluating inside of that function and error in that case. This bit of code in the setup chunk appears to do the trick, in case you're inclined:

# `devtools::build_readme()` evaluates in `callr:r_safe()` which causes issues
# with butcher's memory profiling. Neither RStudio's Knit button nor
# `rmarkdown::render()` have this issue (#280).
if (identical(Sys.getenv("CALLR_IS_RUNNING"), "true")) {
  rlang::abort(c(
    "Build this README with `rmarkdown::render()` rather than `devtools::build_readme()`.",
    "See tidymodels/butcher#280 for more info."
  ))
}

@juliasilge juliasilge merged commit 5836908 into main Jan 28, 2025
10 of 11 checks passed
@juliasilge juliasilge deleted the render-readme branch January 28, 2025 21:51
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.

2 participants