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

Feature/channel specific dependencies #439

Merged

Conversation

ruben-arts
Copy link
Contributor

Works together with conda/rattler#394

@ruben-arts ruben-arts marked this pull request as ready for review November 9, 2023 09:29
pub host_dependencies: Option<IndexMap<String, NamelessMatchSpec>>,

/// The build-dependencies of the project.
#[serde(default, rename = "build-dependencies")]
#[serde_as(as = "Option<IndexMap<_, DisplayFromStr>>")]
#[serde_as(as = "Option<IndexMap<_, PickFirst<(_, DisplayFromStr)>>>")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does PickFirst do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It picks the first serialization that succeeds. This can now be a map or a string.
https://docs.rs/serde_with/latest/serde_with/struct.PickFirst.html

@ruben-arts ruben-arts requested a review from wolfv November 9, 2023 14:20

// Test if the locked channel is equal to the channel that is requested.
if let Some(channel) = &spec.channel {
if !conda.url.as_ref().contains(channel) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in the future we should have a proper channel type and compare the real "channels" instead of contains (I am assuming this would find conda-forge in the full URL, right?

This is not required for this PR IMO, but would be a good future enhancement.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this seems very fragile. This will also work for pytorch with the pytorch-nightly channel for instance which might be very confusing. Maybe just compare the base_url since I think thats whats usually stored in the channel field.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I completely agree. Just don't know how to fix it correctly. I guess we need to do some normalization after the parsing. IIRC, I left a todo in rattler about this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made the check much more precise.

Copy link
Member

@wolfv wolfv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

Comment on lines +801 to +803
let channel = "conda";
let url = "https://conda.anaconda.org/conda-forge/some_package";
assert!(!check_channel_package_url(channel, url));
Copy link
Contributor Author

@ruben-arts ruben-arts Nov 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wolfv This tests that, but with conda instead of pytorch

@wolfv wolfv merged commit 675893c into prefix-dev:main Nov 10, 2023
10 of 11 checks passed
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

Successfully merging this pull request may close these issues.

3 participants