Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks done
matthewfeickert opened this issue Sep 20, 2023 · 2 comments

Comments

@matthewfeickert
Copy link

matthewfeickert commented Sep 20, 2023

Checklist

  • I added a descriptive title
  • 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

def install(
ctx: click.Context,
conda: Optional[str],
mamba: bool,
micromamba: bool,
copy: bool,
prefix: Optional[str],
name: Optional[str],
lock_file: pathlib.Path,
auth: Optional[str],
auth_file: Optional[PathLike],
validate_platform: bool,
log_level: TLogLevel,
dev: bool,
extras: List[str],
) -> None:
# bail out if we do not encounter the lockfile
lock_file = pathlib.Path(lock_file)
if not lock_file.exists():
print(ctx.get_help())
sys.exit(1)

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

@maresb
Copy link
Contributor

maresb commented Sep 20, 2023

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

@matthewfeickert
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants