rextendr icon indicating copy to clipboard operation
rextendr copied to clipboard

Embrace `{usethis}`

Open Ilia-Kosenkov opened this issue 1 year ago • 7 comments

Recent PR #292 shows that we heavily rely on {usethis} and only pretend we can work without it. At this point, I see no particular reason to not depend on {usethis} and drop all hacks that we have in place.

Pinging @CGMossa @multimeric @yutannihilation @eitsupi @JosiahParry

Ilia-Kosenkov avatar Jun 28 '23 09:06 Ilia-Kosenkov

When using functions to create packages, it makes sense to assume that usethis is installed (The rextendr::document function will not work without more massive devtools than usethis!).

However, since this package also has functions unrelated to package creation, it would make sense to keep usethis as an optional dependency.

eitsupi avatar Jun 28 '23 09:06 eitsupi

This topic has been raised again today. I think my personal preference on how to handle this would be to completely error out for functions that require the use of usethis rather than still succeeding but with work arounds that omit the use of usethis.

I think this can be accomplished with rlang::check_installed("usethis") which provides the user with an interactive prompt. If they choose to install the package the function continues and if not, the function errors out.

JosiahParry avatar Nov 17 '23 18:11 JosiahParry

Alright, I personally would go with @JosiahParry solution. If you're up for such a PR, or @kbvernon for that matter, I think that's a good way forward. These packages won't be maintained by us forever, and they need to be in slick shape for the future (mostly also for the god damn present).

CGMossa avatar Nov 17 '23 18:11 CGMossa

I can cast an eye over your R code to check for usethis calls and add rlang::check_installed("usethis") + if (!requireNamespace("usethis")) guards as Josiah suggests. The "workarounds" that come after the else might be a little much for me though, but I can try.

kbvernon avatar Nov 17 '23 18:11 kbvernon