conda / conda-lock

Lightweight lockfile for conda environments
https://conda.github.io/conda-lock/
Other
457 stars 102 forks source link

Allow for conda install to accept URLs to lock files as the lock file positonal argument #511

Open matthewfeickert opened 9 months ago

matthewfeickert commented 9 months ago

Checklist

What is the idea?

Hi. It would be a nice feature to be able to give a URL to a lock file for conda-lock install's lock file positional argument

conda-lock install [OPTIONS] [LOCK_FILE]

as can be done with micromamba create's --file argument.

At the moment conda-lock install explicitly looks for a local file with pathlib.Path

https://github.com/conda/conda-lock/blob/83b18d5cc05b8a04ab0a4ca4b136fba7144457eb/conda_lock/conda_lock.py#L1443-L1463

Why is this needed?

It would be in general nice to be able to have similar syntacic features to the conda/mamba/micromamba create command. To give an explicit example, this create command with a URL to a valid conda-lock file is valid

$ micromamba create --name iris-hep --file https://iris-hep.org/analysis-system-env-nightlies/iris-hep/3.11/conda-lock.yml

but to do the same action with conda-lock install requires downloading it locally first

$ curl -sLO https://iris-hep.org/analysis-system-env-nightlies/iris-hep/3.11/conda-lock.yml
$ conda-lock install --micromamba --name iris-hep conda-lock.yml

This is very much a convienence feature, but it would be nice to have.

What should happen?

The user experience would be that the lock file positional argument in the conda-lock install CLI

conda-lock install [OPTIONS] [LOCK_FILE]

would accept either a valid URL or a valid local path. So both of the following would be valid

Additional Context

No response

maresb commented 9 months ago

That would be pretty awesome. Want to write a PR?

matthewfeickert commented 9 months ago

Want to write a PR?

I'm generally not opposed to it, and I would probably just poke at what micromamba does, but realistically I woudn't be able to start contributing anything for at least a month given the amount of backlog I have for my work. So I would welcome another contributor to beat me to it.