conda-incubator / conda-project

Tool for encapsulating, running, and reproducing projects with Conda environments
https://conda-incubator.github.io/conda-project/
BSD 3-Clause "New" or "Revised" License
28 stars 11 forks source link

newer conda-lock drops optional attribute #129

Closed AlbertDeFusco closed 1 year ago

codecov[bot] commented 1 year ago

Codecov Report

Merging #129 (066d580) into main (dbf457b) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #129   +/-   ##
=======================================
  Coverage   97.69%   97.69%           
=======================================
  Files           9        9           
  Lines         826      826           
=======================================
  Hits          807      807           
  Misses         19       19           
Impacted Files Coverage Δ
src/conda_project/project.py 100.00% <ø> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

AlbertDeFusco commented 1 year ago

Good question. I'll have to check

AlbertDeFusco commented 1 year ago

conda-lock will throw an error during render

pydantic.error_wrappers.ValidationError: 1 validation error for Lockfile
package -> 0 -> category
  none is not an allowed value (type=type_error.none.not_allowed)
mattkram commented 1 year ago

conda-lock will throw an error during render

pydantic.error_wrappers.ValidationError: 1 validation error for Lockfile
package -> 0 -> category
  none is not an allowed value (type=type_error.none.not_allowed)

Okay so my guess is they've got an enum of some sort? I should look.

As long as we're confident that non-optional packages are marked as "main" I say let's merge it.

AlbertDeFusco commented 1 year ago

There is an edge case in conda-lock itself that would be brought up to conda-project. If you provide a category that is not called main.

dependencies:
  - python=3.10
channels: [defaults]
category: not-main

The env will lock but conda-lock install does not find packages in the main category and does not install anything

❯ conda-lock lock
Locking dependencies for ['osx-arm64']...
INFO:conda_lock.conda_solver:osx-arm64 using specs ['python 3.10.*']
 - Install lock using: conda-lock install --name YOURENV conda-lock.yml

❯ conda-lock install -p ./env
INFO:root:Preparing transaction: ...working... done
INFO:root:Verifying transaction: ...working... done
INFO:root:Executing transaction: ...working... done

❯ conda list -p ./env
# packages in environment at ./env:
#
# Name                    Version                   Build  Channel

I think in a separate issue maybe we can address some warnings if no main category is found.