conda / conda-lock

Lightweight lockfile for conda environments
https://conda.github.io/conda-lock/
Other
459 stars 102 forks source link

Allow the use of channels like `channel::package` in TOML files. #425

Closed romain-intel closed 1 year ago

romain-intel commented 1 year ago

This functionality worked for environment.yml type of files but was broken for TOML files.

Description

Small change to allow the use of channel::package in the tool.conda-lock.dependencies section of TOML files.

A test is included. The test fails before this PR and succeeds after. The test specifically includes a package that is available on the channel specified but not on the default conda-forge channel.

netlify[bot] commented 1 year ago

Deploy Preview for conda-lock ready!

Name Link
Latest commit 7e0650fffcb5f047bc605e3ff05ba5fb4172cfec
Latest deploy log https://app.netlify.com/sites/conda-lock/deploys/6478cdc18ca9fa00087df7c5
Deploy Preview https://deploy-preview-425--conda-lock.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

maresb commented 1 year ago

Thanks a lot for this @romain-intel!

It looks like we're starting to manipulate structured data as strings, which tends to eventually lead to issues. I wonder if it would instead make more sense here to lean on conda_spec_to_versioned_dep.

I personally don't understand the design decision of making [tool.conda-lock.dependencies] a dict instead of a list. (It feels like Poetry-motivated insanity.) Consequently, instead of a nice MatchSpec string we now have this awkward depname depattrs key-value-pair. Optimistically, perhaps conda_spec_to_versioned_dep(f"{depname} {depattrs}", "main") might work?

romain-intel commented 1 year ago

That's probably a better solution and more in line with what the environment.yaml does. I can make that change and try it out.

romain-intel commented 1 year ago

There we go -- looks even better. Tiny change :)

maresb commented 1 year ago

Woah, I can't believe that actually worked! :joy: Nicely done!