conda-lock icon indicating copy to clipboard operation
conda-lock copied to clipboard

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

Open matthewfeickert opened this issue 2 years ago • 2 comments

Checklist

  • [X] I added a descriptive title
  • [X] I searched open requests and couldn't find a duplicate

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

  • URL
$ conda-lock install --name iris-hep https://iris-hep.org/analysis-system-env-nightlies/iris-hep/3.11/conda-lock.yml
  • local path (current approach)
$ curl -sLO https://iris-hep.org/analysis-system-env-nightlies/iris-hep/3.11/conda-lock.yml
$ conda-lock install --name iris-hep conda-lock.yml

Additional Context

No response

matthewfeickert avatar Sep 20 '23 04:09 matthewfeickert

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

maresb avatar Sep 20 '23 12:09 maresb

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.

matthewfeickert avatar Sep 20 '23 13:09 matthewfeickert