devtools icon indicating copy to clipboard operation
devtools copied to clipboard

Discourage use of `build_vignettes()`

Open hadley opened this issue 3 years ago • 3 comments

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

hadley avatar Dec 06 '22 22:12 hadley

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()?

  • It leaves a package in a weird state that has features of a source package and an un-packed package bundle.
  • It tends to worsen confusion of the novice or occasional package developer, because of the weird state.
  • It just leads to the need for more workarounds and shims for "regular" tools. I.e. "how do we make browseVignettes() and vignette() find not-really-installed vignettes?"

jennybc avatar Dec 09 '22 22:12 jennybc

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).

hadley avatar Dec 10 '22 00:12 hadley