Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(pypi): pull fewer wheels with experimental_index_url #3058

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

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

Conversation

aignas
Copy link
Collaborator

@aignas aignas commented Jul 5, 2025

Before this we would pull all of the wheels that the user target
configuration would be compatible with and that meant that it was not
customizable. This also meant that there were a lot of footguns in the
configuration where the select statements were not really foolproof.

With this PR we select only those sources that need to be for the
declared configurations.

Freethreaded support should be done by defining extra freethreaded
platforms using the new builder API. It is done as a followup in #3063.

This is also changing the default platforms to be only the fully supported
platforms. This makes the testing easier and avoids us running into
compatibility issues during the rollout.

Work towards #2747
Fixes #2759
Fixes #2849

@aignas aignas force-pushed the exp/pypi-simplify branch from 1d55c50 to c95dce6 Compare July 5, 2025 03:21
@aignas
Copy link
Collaborator Author

aignas commented Jul 5, 2025

Created this as WIP to signal that I am working on this and to invite feedback. The CI should be mostly happy but there are a few TODOs before we can fully merge and I want to test it a little bit more.

  • Freethreaded platform definition should be possible.
  • Probably something else that I need to think of more carefully.

TODO cleanup after this PR is proven to not break things:

@aignas aignas changed the title next: pypi stabilization of experimental_index_url fix(pypi): pull fewer wheels with experimental_index_url Jul 5, 2025
aignas added a commit to aignas/rules_python that referenced this pull request Jul 6, 2025
Stacked on bazel-contrib#3058

This is a continuation of bazel-contrib#3058 where we define freethreaded
platforms. They need to be used only for particular python versions
so I included an extra marker configuration attribute where we
are using pipstar marker evaluation before using the platform.

I think this in general will be a useful tool to configure only
particular platforms for particular python versions

Work towards bazel-contrib#2548, since this shows how we can define custom platforms
Work towards bazel-contrib#2747

TODO:
- [ ] Fix the remaining expectations in the unit tests. Maybe make the
  tests less brittle and define platforms for unit testing.
@aignas
Copy link
Collaborator Author

aignas commented Jul 6, 2025

The CI failure is a flake.

@aignas aignas force-pushed the exp/pypi-simplify branch from 415e893 to dc50a12 Compare July 6, 2025 12:52
aignas added 4 commits July 6, 2025 22:17
This splits the configuration that we have for the `rules_python` and
the defaults that we set for our users from the actual unit tests where
we check that the extension is working correctly.

With this we will be able to dog food the API and point users into the
`MODULE.bazel` as the example snippet.

Work towards bazel-contrib#2949
Work towards bazel-contrib#2747
Before it seems that we were relying on particular names in the pipstar
platforms. This ensures that we rely on this less. Whilst at it fix a
few typos and improve the formatting of the code.

Work towards bazel-contrib#2949
Work towards bazel-contrib#2747
Before this we would pull all of the wheels that the user target
configuration would be compatible with and that meant that it was not
customizable. This also meant that there were a lot of footguns in the
configuration where the select statements were not really foolproof.

With this PR we select only those sources that need to be for the
declared configurations.

Freethreaded support should be done by defining extre freethreaded
platforms using the new builder API.

Work towards bazel-contrib#2747
Work towards bazel-contrib#2759
Work towards bazel-contrib#2849
@aignas aignas force-pushed the exp/pypi-simplify branch from dc50a12 to 855a673 Compare July 6, 2025 13:42
aignas added a commit to aignas/rules_python that referenced this pull request Jul 6, 2025
Stacked on bazel-contrib#3058

This is a continuation of bazel-contrib#3058 where we define freethreaded
platforms. They need to be used only for particular python versions
so I included an extra marker configuration attribute where we
are using pipstar marker evaluation before using the platform.

I think this in general will be a useful tool to configure only
particular platforms for particular python versions

Work towards bazel-contrib#2548, since this shows how we can define custom platforms
Work towards bazel-contrib#2747

TODO:
- [ ] Fix the remaining expectations in the unit tests. Maybe make the
  tests less brittle and define platforms for unit testing.
@aignas
Copy link
Collaborator Author

aignas commented Jul 6, 2025

This would be ready to be reviewed, but because it is stacked on two PRs, let's get those out of the way first.

aignas added a commit to aignas/rules_python that referenced this pull request Jul 6, 2025
Stacked on bazel-contrib#3058

This is a continuation of bazel-contrib#3058 where we define freethreaded
platforms. They need to be used only for particular python versions
so I included an extra marker configuration attribute where we
are using pipstar marker evaluation before using the platform.

I think this in general will be a useful tool to configure only
particular platforms for particular python versions

Work towards bazel-contrib#2548, since this shows how we can define custom platforms
Work towards bazel-contrib#2747

TODO:
- [ ] Fix the remaining expectations in the unit tests. Maybe make the
  tests less brittle and define platforms for unit testing.
aignas added a commit to aignas/rules_python that referenced this pull request Jul 6, 2025
Stacked on bazel-contrib#3058

This is a continuation of bazel-contrib#3058 where we define freethreaded
platforms. They need to be used only for particular python versions
so I included an extra marker configuration attribute where we
are using pipstar marker evaluation before using the platform.

I think this in general will be a useful tool to configure only
particular platforms for particular python versions

Work towards bazel-contrib#2548, since this shows how we can define custom platforms
Work towards bazel-contrib#2747

TODO:
- [ ] Fix the remaining expectations in the unit tests. Maybe make the
  tests less brittle and define platforms for unit testing.
aignas added a commit to aignas/rules_python that referenced this pull request Jul 6, 2025
Stacked on bazel-contrib#3058

This is a continuation of bazel-contrib#3058 where we define freethreaded
platforms. They need to be used only for particular python versions
so I included an extra marker configuration attribute where we
are using pipstar marker evaluation before using the platform.

I think this in general will be a useful tool to configure only
particular platforms for particular python versions

Work towards bazel-contrib#2548, since this shows how we can define custom platforms
Work towards bazel-contrib#2747

TODO:
- [ ] Fix the remaining expectations in the unit tests. Maybe make the
  tests less brittle and define platforms for unit testing.
aignas added a commit to aignas/rules_python that referenced this pull request Jul 6, 2025
Stacked on bazel-contrib#3058

This is a continuation of bazel-contrib#3058 where we define freethreaded
platforms. They need to be used only for particular python versions
so I included an extra marker configuration attribute where we
are using pipstar marker evaluation before using the platform.

I think this in general will be a useful tool to configure only
particular platforms for particular python versions

Work towards bazel-contrib#2548, since this shows how we can define custom platforms
Work towards bazel-contrib#2747

TODO:
- [ ] Fix the remaining expectations in the unit tests. Maybe make the
  tests less brittle and define platforms for unit testing.
aignas added a commit to aignas/rules_python that referenced this pull request Jul 6, 2025
Stacked on bazel-contrib#3058

Since the parent PR is simplifying the code a great deal, we can remove
the unused code and its tests. Hopefully this makes the whole codebase
easier to contribute to. There is probably more cleanup that can be
done, but since the CI is now green, it's a good start.
aignas added a commit to aignas/rules_python that referenced this pull request Jul 6, 2025
Stacked on bazel-contrib#3058

Since the parent PR is simplifying the code a great deal, we can remove
the unused code and its tests. Hopefully this makes the whole codebase
easier to contribute to. There is probably more cleanup that can be
done, but since the CI is now green, it's a good start.
)) | values.env
platforms[key] = struct(
env = env_,
want_abis = [
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's the difference between the abi computed above, and the want_abis here?

@aignas aignas requested a review from hartikainen July 12, 2025 14:19
@aignas aignas force-pushed the exp/pypi-simplify branch from 3d13783 to 548bd54 Compare July 15, 2025 13:31
@aignas
Copy link
Collaborator Author

aignas commented Jul 17, 2025

Just a quick note, this can be reviewed as is, but I want to change up the whl_platform_tags behaviour a little in the upcoming week to fully cover all of the bases. The usage would be:

  • manylinux_*_x86_64 means pick the latest manylinux_x_y_x86_64 package that exists.
  • manylinux_2_31_x86_64 means pick the latest manylinux_x_y_x86_64 package but no later than manylinux_2_31_x86_64.

Right now we just pick the last one in the list, which is a bug. If you have ideas how we can express this idea better, let me know.

@aignas aignas marked this pull request as draft July 18, 2025 01:01
@aignas aignas force-pushed the exp/pypi-simplify branch from f50d6f9 to 0427182 Compare July 18, 2025 13:42
@aignas aignas marked this pull request as ready for review July 18, 2025 13:42
@aignas
Copy link
Collaborator Author

aignas commented Jul 18, 2025

@keith, @hartikainen, could you please retest this PR if it works with your setup.

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.

experimental_index_url slows down downloads by 25-50% "Illegal ambiguous match" error with experimental_index_url
4 participants