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

incorrect install command suggested in conda-lock.yml comments with 'dev' extra dependencies #641

Open
2 tasks done
qmarcou opened this issue May 23, 2024 · 1 comment
Open
2 tasks done

Comments

@qmarcou
Copy link
Contributor

qmarcou commented May 23, 2024

Checklist

  • I added a descriptive title
  • I searched open reports and couldn't find a duplicate

What happened?

After building a lock file from a pyproject.toml with optional dependencies named 'dev':
conda-lock --extras dev -f pyproject.toml --mamba with pyproject.toml being:

[project]
name = "MNWE"
dynamic = ["version"]
dependencies = [
    "python",
]

[project.optional-dependencies]
dev = [
    "pytest",
]

[tool.conda-lock]
channels = [
    'conda-forge', 'defaults'
]
platforms = [
    'win-64'
]

the conda-lock.yml header displays incorrect install information:

# This lock contains optional development dependencies. Include them in the installed environment with:
#     conda-lock install --dev-dependencies -n YOURENV conda-lock.yml

which fails

conda-lock install --dev-dependencies -n YOURENV conda-lock.yml
Usage: conda-lock install [OPTIONS] [LOCK_FILE]
Try 'conda-lock install --help' for help.

Error: No such option: --dev-dependencies

Both :
conda-lock install --dev -n YOURENV conda-lock.yml and conda-lock install -e dev -n YOURENV conda-lock.yml work, any of these two commands should be suggested instead.

I guess these lines should be deleted (if the -e option is prefered) or updated:

if "dev" in categories:
write_section(
f"""
This lock contains optional development dependencies. Include them in the installed environment with:
conda-lock install --dev-dependencies -n YOURENV {path.name}
"""
)

When using any other name than dev (e.g foo) for extras the correct command is suggested : conda-lock install -e foo -n YOURENV conda-lock.yml

Conda Info

active environment : lock-env
    active env location : C:\Users\zzzzz\AppData\Local\miniconda3\envs\lock-env
            shell level : 2
       user config file : C:\Users\zzzzz\.condarc
 populated config files :
          conda version : 24.4.0
    conda-build version : not installed
         python version : 3.10.14.final.0
                 solver : libmamba (default)
       virtual packages : __archspec=1=skylake_avx512
                          __conda=24.4.0=0
                          __win=0=0
       base environment : C:\Users\zzzzz\AppData\Local\miniconda3  (writable)
      conda av data dir : C:\Users\zzzzz\AppData\Local\miniconda3\etc\conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\Users\zzzzz\AppData\Local\miniconda3\pkgs
                          C:\Users\zzzzz\.conda\pkgs
                          C:\Users\zzzzz\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\zzzzz\AppData\Local\miniconda3\envs
                          C:\Users\zzzzz\.conda\envs
                          C:\Users\zzzzz\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/24.4.0 requests/2.28.1 CPython/3.10.14 Windows/10 Windows/10.0.19045 solver/libmamba conda-libmamba-solver/24.1.0 libmambapy/1.5.8
          administrator : False
             netrc file : None
           offline mode : False

Conda Config

# nothing

Conda list

No response

Additional Context

This is in between documentation and bug issue and I wasn't sure how to assign it. This is also somewhat related to #255 .

@maresb
Copy link
Contributor

maresb commented May 23, 2024

@mariusvniekerk, is there any reason not to deprecate all the dev related flags on conda-lock install and conda-lock render? It seems to me like --extras dev is equivalent, and much less confusing.

And I think we should readd --dev-dependencies with a deprecation error.

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