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

Ensure consistent precedence of categories

Open g-rutter opened this issue 2 years ago • 0 comments

This is related to #278 and is a much smaller change that could make the current implementation with a single category per package more useful.

Consistent precedence

Take this command, where the first yml sets category: dev and the second category: main:

conda-lock lock dev-deps.yml main-deps.yml

All dependencies which occur in both dep trees should get set to category 'main' - the latter of the ymls specified gets precedence. Then, a well-specified environment will be built whether using --dev-dependencies or --no-dev-dependencies.

This almost works. The exception is that packages listed in dev-deps.yml and required by main-deps.yml but not listed explicitly, will get set as `dev'. That means it's excluded from the prod environment even though it's needed!

Current example

main-deps.yml:

channels:
  - conda-forge

dependencies:
  - python=3.7
  - importlib_metadata

dev-deps.yml:

channels:
  - conda-forge

dependencies:
  - python=3.7
  - importlib_metadata
  - importlib-metadata

category: dev

Run conda-lock lock -f dev-deps.yml -f main-deps.yml -p linux-64

You will see that importlib-metadata is considered a 'dev' dependency despite being needed in prod - importlib_metadata depends on it. All other [sub-]dependencies are correctly labelled 'main'.

g-rutter avatar Jan 04 '23 18:01 g-rutter