Skip to content

fix: Recognize incompatible python wheels#5273

Merged
baszalmstra merged 3 commits intoprefix-dev:mainfrom
hunger:feature/pix-1155-updating-system-requirements-may-result-in-pypi-dependencies
Jan 13, 2026
Merged

fix: Recognize incompatible python wheels#5273
baszalmstra merged 3 commits intoprefix-dev:mainfrom
hunger:feature/pix-1155-updating-system-requirements-may-result-in-pypi-dependencies

Conversation

@hunger
Copy link
Contributor

@hunger hunger commented Jan 12, 2026

Description

Figure out that the lock file needs to be re-checked when system requirements change.

Calculate the lost of possible tags a wheel can have and check that those match up to the wheels found in the wheel.

Fixes #4607

How Has This Been Tested?

manually

AI Disclosure

Tools: None

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added sufficient tests to cover my changes.

@hunger hunger requested a review from baszalmstra January 12, 2026 15:51
@hunger
Copy link
Contributor Author

hunger commented Jan 12, 2026

This is for initial feedback only. I think this approach works, but I am sure somebody with more Conda-magic can shoot holes into it.

@hunger hunger force-pushed the feature/pix-1155-updating-system-requirements-may-result-in-pypi-dependencies branch from ff59661 to 91f1e59 Compare January 12, 2026 17:31
@hunger
Copy link
Contributor Author

hunger commented Jan 12, 2026

The latest version should still be slower than the current code as it does one extra iteration over all packages to find the python packages for each environment. This is only done when pypi packages are actually used now though:-)

@tdejager
Copy link
Contributor

This looks correct to me, excellent! Did you check it against the original issue?

Copy link
Contributor

@baszalmstra baszalmstra left a comment

Choose a reason for hiding this comment

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

I left one comment where I think the code is more complex than it needs to be, but otherwise looks great!

Comment on lines 545 to 567
let checks = {
let mut tmp = Vec::new();
if let Some(no_build) = group_pypi_options.no_build.as_ref()
&& let Some(func) = verify_pypi_no_build(no_build)
{
// Check that if `no-build` is set, we only have binary packages
// or that the package that we disallow are not built from source
tmp.push(func);
}

// Check that all wheels still match with the system requirements
tmp.push(verify_pypi_wheel_tags(environment, locked_environment));
tmp
};

// Actually check all pypi packages in one iteration
for (platform, package_it) in locked_environment.pypi_packages_by_platform() {
for (package_data, package_env_data) in package_it {
for c in &checks {
(c)(platform, package_data, package_env_data)?;
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of creating a vec with boxed functions, couldnt we just build booleans, that indicate whether a certain thing needs to be checked and then use those in the inner for loop? I think that will improve readability.

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 went for boxed functions as that nicely captures all the necessary context.

It was pretty ugly to set up and pass around the state that the functions need.

Figure out that the lock file needs to be re-checked
when system requirements change.

Calculate the lost of possible tags a wheel can have
and check that those match up to the wheels found in
the wheel.
@hunger hunger force-pushed the feature/pix-1155-updating-system-requirements-may-result-in-pypi-dependencies branch from ed87513 to 5459ef6 Compare January 13, 2026 10:04
@hunger
Copy link
Contributor Author

hunger commented Jan 13, 2026

The latest iteration re-visits the latest change only: I redid it without Boxed lambda functions :-)

The rest is unchanged but rebased on top of current main.

@hunger hunger force-pushed the feature/pix-1155-updating-system-requirements-may-result-in-pypi-dependencies branch from 5459ef6 to e206399 Compare January 13, 2026 10:07
@tdejager
Copy link
Contributor

Satisfiability seems to be failing :)

Do not over-complicate this: Use simple Check structs with
a member function over Boxed function objects.
@hunger hunger force-pushed the feature/pix-1155-updating-system-requirements-may-result-in-pypi-dependencies branch from e206399 to f819ba8 Compare January 13, 2026 12:14
@hunger
Copy link
Contributor Author

hunger commented Jan 13, 2026

... and forgot to move the cargo-insta data, now that the PR fixing the test names is merged :-/

@baszalmstra baszalmstra merged commit 98a821c into prefix-dev:main Jan 13, 2026
72 of 73 checks passed
@hunger hunger deleted the feature/pix-1155-updating-system-requirements-may-result-in-pypi-dependencies branch January 13, 2026 14:05
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.

updating system requirements may result in pypi dependencies being outdated

3 participants