Skip to content

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

@qmarcou

Description

@qmarcou

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 .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions