opensafely-core / r-docker

Docker image for running R scripts in OpenSAFELY
1 stars 3 forks source link

Add butcher package (version 0.1.5 is the latest that can be achieved - need to add lobstr@1.1.1 first) #127

Closed remlapmot closed 1 month ago

remlapmot commented 1 year ago

For completeness, given that butcher is mentioned in the docs here I had a look at adding it using the new machinery.

Previously, using snapshot repositories I had worked out that I could install butcher version 0.1.5 without updating any of its dependencies, and this also added and 1 new dependency package, lobstr.

A bit to my surprise naively running

just add-package butcher@0.1.5

not only added lobstr but bumped cpp11 and rlang. This turned out to because lobstr 1.1.2 was added because that is its current version on CRAN, and that requires the bumps to the other 2. Whereas the snapshot date I used had version 1.1.1 as its current version of lobstr.

Hence using the new machinery, running in order

just add-package lobstr@1.1.1
just add-package butcher@0.1.5

achieves the installation of butcher without bumping the other 2.

@bloodearnest - this made me think - do you think you would allow adding an additional repos parameter to the add-package recipe, because I could achieve those 2 lines above with a single line with syntax such as

just add-package butcher@0.1.5 https://packagemanager.posit.co/cran/2021-06-29

where the new repos parameter is passed to the renv::install() call on line 69 of the Dockerfile, i.e., that syntax would expand to

renv::install("butcher@0.1.5", repos = "https://packagemanager.posit.co/cran/2021-06-29")

Having this parameter would make it easier to add packages without bumping dependencies in the future (because otherwise you have to manually work out the order in which to add the new dependencies, which could be tricky if there was more than 1 as in this case).