Skip to content

Provide support or recommendation for how to interact with conda-lock lockfiles #1312

@matthewfeickert

Description

@matthewfeickert

Proposed change

At the moment, repo2docker supports conda/mamba/micromamba environment.yml environment files as Binder config files. This is great, but even if you pin packages with == their dependencies can still float and so reproducibility into the future can break. For long term reproducible builds (e.g. launching into Binder from a Zenodo DOI) you would want to be able to also have repo2docker work with lock files. As the conda ecosystem is already supported a natural extension would be to use conda-lock, and with mamba/micromamba you can interact with conda-lock lock files on a nearly equal footing as you would an environment.yml.

However, at the moment, if you place a conda-lock lock file named environment.yml under a binder/ directory in a repo, repo2docker will fail to build from it and error with

EnvironmentSectionNotValid: The following sections on '/home/jovyan/binder/environment.yml' are invalid and will be ignored:
 - version
 - metadata
 - package

(c.f. matthewfeickert-talks/talk-pyhep-2023#5)

It would be super nice if conda-lock lock files could have support added for them as a valid repo2docker config file.

Alternative options

Though if that is too big of a feature request, it would be nice if there was a method to allow users to interact with a conda-lock lock file that works with postBuild. At the moment, if you try to have a postBuild config file that has

conda env update --file binder/conda-lock.yml --prune

this will again fail with

EnvironmentSectionNotValid: The following sections on '/home/jovyan/binder/environment.yml' are invalid and will be ignored:
 - version
 - metadata
 - package

While micromamba is able to handle a command like

micromamba install --file binder/conda-lock.yml

it seems that conda can not and so similarly having a postBuild file with

conda install --file binder/conda-lock.yml

will fail with

CondaValueError: could not parse 'version: 1' in: binder/conda-lock.yml

If the ability to install an environment from a conda-lock lock file without supporting conda-lock could be supported then if instructions on how to work with conda-lock lock files were also added this could resolve things as well.

Who would use this feature?

People that want to ensure that a Binder link will run far into the future (so maybe the same people that put things on Zenodo).

How much effort will adding it take?

I'm not sure. I would hope not much, but I haven't taken the time to look at how repo2docker currently supports all the config files it already does.

Who can do this work?

Someone with familiarity with conda-lock.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions