r-lib / devtools

Tools to make an R developer's life easier
https://devtools.r-lib.org
Other
2.37k stars 755 forks source link

Discourage use of `build_vignettes()` #2488

Open hadley opened 1 year ago

hadley commented 1 year ago

Since it creates artefacts in a way that we no longer recommend.

jennybc commented 1 year ago

Having thought about this a lot while revising R Package, I'm going to record some thoughts before they leave my head.

Why do people use build_vignettes() and, in each case, what do I think is the better way to go:

  1. To build their vignettes and have a look at them, because they are actively working on the vignettes.

    I now think this is a job for devtools::build_rmd() or click the "Install" button in RStudio then the "Knit" button.

  2. To build their vignettes, for local reading by the local user.

    I now think this means you should build and install your package locally.

  3. To make built vignettes available for other people to read, because your package is not on CRAN or you want to make vignettes available for the dev version. Presumably it's a given that the package in question is available on GitHub (or similar).

    I now think this means you should (a) have a pkgdown website and it should either (b) be based on the dev version or have both released and dev sites.

  4. To make built vignettes available for other people to install.

    Either let people do install_github(dependencies = TRUE, build_vignettes = TRUE) or, if you're worried they can't build vignettes, then advise folks to install from r-universe.

What's wrong with build_vignettes()?

hadley commented 1 year ago

One other thought on the first point: I think we should work with @romainfrancois to make knitting a vignette automatically install the package to a temporary library path first (figuring out some caching to make it not too slow).