-
-
Notifications
You must be signed in to change notification settings - Fork 606
feat: freethreaded support for the builder API #3063
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
Draft
aignas
wants to merge
5
commits into
bazel-contrib:main
Choose a base branch
from
aignas:exp/pypi-simplify-freethreaded
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+745
−616
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a5dc20c
refactor(pypi): move the platform config to MODULE.bazel
aignas ead6071
fix(pypi): correctly handle custom names in pipstar platforms
aignas 5c29535
fix(pypi): pull fewer wheels
aignas 855a673
Merge branch 'test/independent-platforms' into exp/pypi-simplify
aignas 5e66b5b
feat: freethreaded support for the builder API
aignas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,9 +60,121 @@ register_toolchains("@pythons_hub//:all") | |
# Install twine for our own runfiles wheel publishing and allow bzlmod users to use it. | ||
|
||
pip = use_extension("//python/extensions:pip.bzl", "pip") | ||
|
||
# NOTE @aignas 2025-07-06: we define these platforms to keep backwards compatibility with the | ||
# current `experimental_index_url` implementation. Whilst we stabilize the API this list may be | ||
# updated with a mention in the CHANGELOG. | ||
[ | ||
pip.default( | ||
arch_name = cpu, | ||
config_settings = [ | ||
"@platforms//cpu:{}".format(cpu), | ||
"@platforms//os:linux", | ||
"//python/config_settings:_is_py_freethreaded_{}".format( | ||
"yes" if freethreaded else "no", | ||
), | ||
], | ||
env = {"platform_version": "0"}, | ||
marker = "python_version ~= \"3.13\"" if freethreaded else "", | ||
os_name = "linux", | ||
platform = "linux_{}{}".format(cpu, freethreaded), | ||
platform_tags = [ | ||
"linux_*_{}".format(cpu), | ||
"manylinux_*_{}".format(cpu), | ||
], | ||
want_abis = [ | ||
"cp{0}{1}t", | ||
"none", | ||
] if freethreaded else [], | ||
) | ||
for cpu in [ | ||
"x86_64", | ||
"aarch64", | ||
# TODO @aignas 2025-05-19: only leave tier 0-1 cpus when stabilizing the | ||
# `pip.default` extension. i.e. drop the below values - users will have to | ||
# define themselves if they need them. | ||
"arm", | ||
"ppc", | ||
"s390x", | ||
] | ||
for freethreaded in [ | ||
"", | ||
"_freethreaded", | ||
] | ||
] | ||
|
||
[ | ||
pip.default( | ||
arch_name = cpu, | ||
config_settings = [ | ||
"@platforms//cpu:{}".format(cpu), | ||
"@platforms//os:osx", | ||
"//python/config_settings:_is_py_freethreaded_{}".format( | ||
"yes" if freethreaded else "no", | ||
), | ||
], | ||
# We choose the oldest non-EOL version at the time when we release `rules_python`. | ||
# See https://endoflife.date/macos | ||
env = {"platform_version": "14.0"}, | ||
marker = "python_version ~= \"3.13\"" if freethreaded else "", | ||
os_name = "osx", | ||
platform = "osx_{}{}".format(cpu, freethreaded), | ||
platform_tags = [ | ||
"macosx_*_{}".format(suffix) | ||
for suffix in platform_tag_cpus | ||
], | ||
want_abis = [ | ||
"cp{0}{1}t", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: |
||
"none", | ||
] if freethreaded else [], | ||
) | ||
for cpu, platform_tag_cpus in { | ||
"aarch64": [ | ||
"universal2", | ||
"arm64", | ||
], | ||
"x86_64": [ | ||
"universal2", | ||
"x86_64", | ||
], | ||
}.items() | ||
for freethreaded in [ | ||
"", | ||
"_freethreaded", | ||
] | ||
] | ||
|
||
[ | ||
pip.default( | ||
arch_name = "x86_64", | ||
config_settings = [ | ||
"@platforms//cpu:x86_64", | ||
"@platforms//os:windows", | ||
"//python/config_settings:_is_py_freethreaded_{}".format( | ||
"yes" if freethreaded else "no", | ||
), | ||
], | ||
env = {"platform_version": "0"}, | ||
marker = "python_version ~= \"3.13\"" if freethreaded else "", | ||
os_name = "windows", | ||
platform = "windows_x86_64{}".format(freethreaded), | ||
platform_tags = ["win_amd64"], | ||
want_abis = [ | ||
"cp{0}{1}t", | ||
"none", | ||
] if freethreaded else [], | ||
) | ||
for freethreaded in [ | ||
"", | ||
"_freethreaded", | ||
] | ||
] | ||
|
||
pip.parse( | ||
# NOTE @aignas 2024-10-26: We have an integration test that depends on us | ||
# being able to build sdists for this hub, so explicitly set this to False. | ||
# | ||
# how do we test sdists? Maybe just worth adding a single sdist somewhere? | ||
download_only = False, | ||
experimental_index_url = "https://pypi.org/simple", | ||
hub_name = "rules_python_publish_deps", | ||
|
@@ -155,22 +267,19 @@ dev_pip = use_extension( | |
dev_dependency = True, | ||
) | ||
dev_pip.parse( | ||
download_only = True, | ||
experimental_index_url = "https://pypi.org/simple", | ||
hub_name = "dev_pip", | ||
parallel_download = False, | ||
python_version = "3.11", | ||
requirements_lock = "//docs:requirements.txt", | ||
) | ||
dev_pip.parse( | ||
download_only = True, | ||
experimental_index_url = "https://pypi.org/simple", | ||
hub_name = "dev_pip", | ||
python_version = "3.13", | ||
requirements_lock = "//docs:requirements.txt", | ||
) | ||
dev_pip.parse( | ||
download_only = True, | ||
experimental_index_url = "https://pypi.org/simple", | ||
hub_name = "pypiserver", | ||
python_version = "3.11", | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty sure this should be >= 3.13