Devtools: build only one vignette using dev package version

Created on 31 Jan 2020  路  5Comments  路  Source: r-lib/devtools

TL;DR: it would be great to be able to use build_vignettes logic for only knitting one vignette.

This is from experiences during tidydevday in SF. Some people were working on documentations in Rmd for vignettes. However, in the Rmd file they have a library call like library(dplyr). When knitting, it then uses by default the library installed in their library path and not the current dev version they are working on.

Currently, I see two workflows:

  • Installing the dev version locally then work on the vignette and knit to render
  • use devtools::build_vignettes(..., install = TRUE) (which is the default) to build the vignettes by building first the current dev package in a temp libpath.

I find the second one safer, but it builds all the vignettes with tools::buildVignettes and not offering to render one Rmd only.

Maybe there could be an option or a new function to only render one Rmd file when working on a vignette and applying the logic of devtools::build_vignettes(..., install = TRUE):

  • install the current dev version of the package in a temp library path
  • render the vignette using this temp lib path
  • do that in another background using callr session for safety

Their could also be something to do in the IDE so that knitting can be done with the dev version when in a vignette. Or maybe in rmarkdown::html_vignette format so that rmarkdown::render can help with that.

I think this could definitely helped when working on vignettes.

feature

All 5 comments

build_rmd() probably gets you pretty close to what you need.

(That's not a full solution because it only works for .Rmd vignettes, but it's probably most of what we need. See also #2203 where the idea is to just make the knit button just work)

Yes I think the new build_rmd() function will help to with this. devtools::build_rmd("vignettes/lua-filters.Rmd") for example does the job. And with #2203 the experience can be a lot better, and I'll think about it.

You can close I guess now, unless you want to provide something different for this.

It seems like the other issue captures the intent here (making it as easy as possible to iterate on vignettes) so let鈥檚 close this one. We should try to improve the experience before the next TDD but that鈥檚 unlikely to happen for at least 12 months.

We should try to improve the experience before the next TDD but that鈥檚 unlikely to happen for at least 12 months.

Great let's do this.

Was this page helpful?
0 / 5 - 0 ratings