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

Fix use_data() + use_standalone() by not allowing decreasing R dependency #2077

Closed
wants to merge 2 commits into from

Conversation

olivroy
Copy link
Contributor

@olivroy olivroy commented Oct 25, 2024

To fix a drawback from #2043

Basically, if I have a dependency on R 4.1 and call use_data(), it will decrease version to 3.5. Same thing if I require rlang 1.1.4 and call usethis::use_standalone("r-lib/rlang", "types-check")

In short if I have DESCRIPTION

Depends: R (>= 4.1)

And I call this:

usethis::use_data(data, overwrite = TRUE)
✔ Setting active project to "usethis".Decreasing R version to ">= 3.5" in DESCRIPTION.Saving "data" to "data/data.rda".

But this is incorrect.

The PR fixes it.

However, I fixed it in the helper function only. If an external package relied on use_package(), it would error.

Agreed that if I call interactively

usethis::use_package("R", "depends", "3.5")

it should decrease by default.

@olivroy olivroy changed the title Add allow_decrease = FALSE for certain operations of usethis Fix use_data() decreasing R dependency Oct 25, 2024
@olivroy olivroy changed the title Fix use_data() decreasing R dependency Fix use_data() by not allowing decreasing R dependency Oct 25, 2024
@jennybc
Copy link
Member

jennybc commented Nov 20, 2024

Thanks for catching this! I'm going to solve it in a different way, but am glad you brought it to my attention. I have learned the hard way that use_dependency() is very easy to introduce bugs into, so I'll fix this in use_data().

@olivroy olivroy changed the title Fix use_data() by not allowing decreasing R dependency Fix use_data() + use_standalone() by not allowing decreasing R dependency Nov 20, 2024
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