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

feat: no-build option #2997

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Conversation

tdejager
Copy link
Contributor

@tdejager tdejager commented Jan 23, 2025

This PR adds the no-build option for pypi-dependencies that dis-allow the building of sdists, we are planning in using this in conjunction with: #2994 to have a much faster solve for environments that do not need the full conda prefix and will not build PyPI source distributions.

This PR will be standalone in the fact that it can be used without the features listed above.

This is what the error looks like when no-build is enabled:

 pixi add --pypi sdist                                                                                                                                                                                                                       ─╯
Error:
  × failed to solve the pypi requirements of 'default' 'osx-arm64'
  ├─▶ failed to resolve pypi dependencies
  ╰─▶ Because sdist==0.0.0 has no usable wheels and building from source is disabled and only sdist==0.0.0 is available, we can conclude that all versions of sdist cannot be used.
      And because you require sdist, we can conclude that your requirements are unsatisfiable.

@tdejager tdejager marked this pull request as draft January 23, 2025 19:12
@tdejager tdejager requested a review from nichmor January 25, 2025 12:03
@tdejager tdejager requested a review from ruben-arts January 25, 2025 13:07
@tdejager tdejager marked this pull request as ready for review January 25, 2025 13:07
@tdejager
Copy link
Contributor Author

@ruben-arts This should be ready for a review, and should already work without the other functionality mentioned in this PR.

@@ -342,6 +397,7 @@ mod tests {
find_links: None,
no_build_isolation: None,
index_strategy: Some(IndexStrategy::UnsafeBestMatch),
no_build: Default::default(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Please also test a merge of these options

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now testing a lot more!

pub enum NoBuild {
/// Build any sdist we come across
#[default]
None,
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought you wanted to make this either true or false or a list of names. I don't believe all and none are going to make it easier, and it makes it less aligned with uv, although it already isn't ;)

no-build = true

or

no-build = ["numpy"]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed it to like you said!

impl NoBuild {
/// Merges two `NoBuild` together, according to the following rules
/// - If either is `All`, the result is `All`
/// - If either is `None`, the result is the other
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we're missing the "undefined" case here.
I believe this function is most important for the feature merging. The priority of the other merges should be followed. So the one with the higher priority should win. Apart from the list of packages, there I believe we should extend the list.

In the current case if some feature makes it no-build, you can't override it with a higher priority feature.

If my explanation is not clear, let's call about it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, that was a clear oversight corrected this. And in conjunction also made it a HashSet of packages to avoid duplication, although that should not have mattered much.

@tdejager
Copy link
Contributor Author

@ruben-arts I also some some incosistencies in the uv conversions, because I had to touch these I also:

  1. Moved everything to the same conversions.rs file
  2. Name everything to_* when it takes a reference but produces a value.
  3. Renamed a function with the exact same name but a typo.

[pypi-options]
no-build = ["package1", "package2"]
```

Copy link
Contributor

Choose a reason for hiding this comment

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

Please document what the override logic is of these options

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 tried to do so can you give it a check? Tried to err on the side of being succinct.

schema/model.py Outdated Show resolved Hide resolved
@@ -20,8 +20,8 @@ use pixi_manifest::FeaturesExt;
use pixi_record::{LockedGitUrl, ParseLockFileError, PixiRecord, SourceMismatchError};
use pixi_spec::{PixiSpec, SourceSpec, SpecConversionError};
use pixi_uv_conversions::{
as_uv_req, as_uv_specifiers, as_uv_version, into_pixi_reference, to_normalize,
Copy link
Contributor

Choose a reason for hiding this comment

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

If an environment is solved with no-build = false and later that changes to true, we should resolve if we depend on sdists. Assuming we can just look for tar.gz that shouldn't be to hard right?
We can skip the other way around as that doesn't invalidate the manifest with the lockfile and a pixi update should fix those issues.

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.

2 participants