Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,62 @@ 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",
],
env = {"platform_version": "0"},
os_name = "linux",
platform = "linux_{}".format(cpu),
)
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",
]
]

[
pip.default(
arch_name = cpu,
config_settings = [
"@platforms//cpu:{}".format(cpu),
"@platforms//os:osx",
],
# 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"},
os_name = "osx",
platform = "osx_{}".format(cpu),
)
for cpu in [
"aarch64",
"x86_64",
]
]

pip.default(
arch_name = "x86_64",
config_settings = [
"@platforms//cpu:x86_64",
"@platforms//os:windows",
],
env = {"platform_version": "0"},
os_name = "windows",
platform = "windows_x86_64",
)
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.
Expand Down
60 changes: 1 addition & 59 deletions python/private/pypi/extension.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -393,64 +393,6 @@ def _configure(config, *, platform, os_name, arch_name, config_settings, env = {
else:
config["platforms"].pop(platform)

def _create_config(defaults):
if defaults["platforms"]:
return struct(**defaults)

# NOTE: We have this so that it is easier to maintain unit tests assuming certain
# defaults
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",
]:
_configure(
defaults,
arch_name = cpu,
os_name = "linux",
platform = "linux_{}".format(cpu),
config_settings = [
"@platforms//os:linux",
"@platforms//cpu:{}".format(cpu),
],
env = {"platform_version": "0"},
)
for cpu in [
"aarch64",
"x86_64",
]:
_configure(
defaults,
arch_name = cpu,
# We choose the oldest non-EOL version at the time when we release `rules_python`.
# See https://endoflife.date/macos
os_name = "osx",
platform = "osx_{}".format(cpu),
config_settings = [
"@platforms//os:osx",
"@platforms//cpu:{}".format(cpu),
],
env = {"platform_version": "14.0"},
)

_configure(
defaults,
arch_name = "x86_64",
os_name = "windows",
platform = "windows_x86_64",
config_settings = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
],
env = {"platform_version": "0"},
)
return struct(**defaults)

def parse_modules(
module_ctx,
_fail = fail,
Expand Down Expand Up @@ -527,7 +469,7 @@ You cannot use both the additive_build_content and additive_build_content_file a
# for what. We could also model the `cp313t` freethreaded as separate platforms.
)

config = _create_config(defaults)
config = struct(**defaults)

# TODO @aignas 2025-06-03: Merge override API with the builder?
_overriden_whl_set = {}
Expand Down
Loading