nimble icon indicating copy to clipboard operation
nimble copied to clipboard

Packaging for conda-forge

Open brendanf opened this issue 4 years ago • 6 comments

I'm working on packaging nimble for conda-forge, and I have a couple questions:

  1. Does anyone from the dev team want to be added as a recipe maintainer? For R packages this is usually a very small commitment, since the conda-forge tooling automatically creates pull requests for new versions whenever they are released on CRAN, and merges the PR as long as it passes testing on all platforms. As long as nothing goes wrong, it amounts to a few notification e-mails from the bot. You would also get notifications from people filing installation issues at conda-forge if anything ever came up.

  2. The standard testing for an R package on Conda-Forge is just to verify that the package loads. In the case of Nimble, this doesn't really seem sufficient; I'd like to additionally be sure that it can successfully compile a model. I think that this just work without extra effort, since the r-base conda package insures that a compiler is present, but I'd still like to set up a test in the recipe, to verify that this is the case on all platforms. Can you recommend a minimal test for compiling a model, either a test script that's already included in the package or a quick snippet I could run?

brendanf avatar Jun 25 '20 16:06 brendanf

@brendanf This is an exciting development. Thanks for filing the issue and contacting us.

Would you mind taking just a moment to elaborate further on the benefits and implications of nimble being included in the conda-forge collection?

I, at least, will volunteer to be added as a recipe maintainer, and you might also include @perrydv or @paciorek, I suspect one or both of them might also be interested.

I agree, including testing at the very least for loading the nimble package, creating a barebones nimble model object, and invoking the nimble compiler, is important. I'll put a few lines of code below which accomplish this.

library(nimble)
code <- nimbleCode({ x ~ dnorm(0, 1) })
Rmodel <- nimbleModel(code)
Cmodel <- compileNimble(Rmodel)

danielturek avatar Jun 25 '20 16:06 danielturek

I personally use conda environments for all my research, because it enables me to manage versions of all the software I'm using in an (ideally) reproducible and (hopefully) platform-independent way, as well as being able to install things on a cluster without admin rights. This includes R and Python packages, as well as R and Python themselves, dynamic libraries, command-line tools, etc. I've gotten in the habit of building a package on Conda-Forge for anything that I'm interested in using if it's not already there. Conda-Forge is the main community-driven repository of conda packages, and the one that currently has the most R packages, but it by no means covers all of CRAN.

Within the R world, using conda makes things a little more complicated, compared to install.packages() or solutions like renv, because in order to be tracked by conda, each package needs its own conda recipe.

For the case of packages which have additional dependencies outside of R, I think conda is an improvement over R's package management facilities, because it's possible to specify those external dependencies as well, and they will be automatically installed as necessary when the conda package is installed. For instance, it's possible to list eigen and gcc as requirements for nimble, so they will always be present after it is installed. I'm not sure if this really improves the situation for installing nimble on, e.g. Windows, since installing conda itself isn't necessarily any easier than installing RTools.

brendanf avatar Jun 25 '20 17:06 brendanf

Conda-Forge's policy is that anyone to be listed as a maintainer needs to affirm that, so if @perrydv or @paciorek want to be added, they will need to say so personally. For now, I'll add you, @danielturek. And thanks for the snippet, let's see if it works...

brendanf avatar Jun 25 '20 17:06 brendanf

@brendanf Thanks for doing this - I'm very happy to see this, and agree with your comments. I'd like to be added as a maintainer.

Side note: I don't think eigen is needed as a requirement as we provide with the nimble R package.

paciorek avatar Jun 25 '20 17:06 paciorek

Side note: I don't think eigen is needed as a requirement as we provide with the nimble R package.

OK, I saw the alternate instructions to install using another version of eigen and thought that might be worth doing, since it is already packaged by Conda-Forge.

Somewhat on the same note, since Eigen is included, there should probably also be a license file for it included.

brendanf avatar Jun 25 '20 20:06 brendanf

In inst/COPYRIGHTS we have licensing info for Eigen. It's rather tedious because of the number of people who have contributed to Eigen...

paciorek avatar Jul 07 '20 14:07 paciorek