From 88df4f8ba5481cabb407e569eb9b45b699ff8474 Mon Sep 17 00:00:00 2001 From: Garrett Holmstrom Date: Mon, 18 Nov 2024 15:31:28 -0800 Subject: [PATCH 1/4] Add extra_hub_aliases to pip_repository too --- python/private/pypi/attrs.bzl | 10 ++++++++++ python/private/pypi/extension.bzl | 10 ---------- python/private/pypi/pip_repository.bzl | 1 + 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/python/private/pypi/attrs.bzl b/python/private/pypi/attrs.bzl index c6132cb6c1..56b9335247 100644 --- a/python/private/pypi/attrs.bzl +++ b/python/private/pypi/attrs.bzl @@ -151,6 +151,16 @@ or empty in the environment), if `"VARNAME"` is listed in the `envsubst` attribute. See also `envsubst`. """, ), + "extra_hub_aliases": attr.string_list_dict( + doc = """\ +Extra aliases to make for specific wheels in the hub repo. This is useful when +paired with the {attr}`whl_modifications`. + +:::{versionadded} 0.38.0 +::: +""", + mandatory = False, + ), "isolated": attr.bool( doc = """\ Whether or not to pass the [--isolated](https://pip.pypa.io/en/stable/cli/pip/#cmdoption-isolated) flag to diff --git a/python/private/pypi/extension.bzl b/python/private/pypi/extension.bzl index ea2bafdb77..3df7b52e8a 100644 --- a/python/private/pypi/extension.bzl +++ b/python/private/pypi/extension.bzl @@ -750,16 +750,6 @@ The indexes must support Simple API as described here: https://packaging.python.org/en/latest/specifications/simple-repository-api/ """, ), - "extra_hub_aliases": attr.string_list_dict( - doc = """\ -Extra aliases to make for specific wheels in the hub repo. This is useful when -paired with the {attr}`whl_modifications`. - -:::{versionadded} 0.38.0 -::: -""", - mandatory = False, - ), "hub_name": attr.string( mandatory = True, doc = """ diff --git a/python/private/pypi/pip_repository.bzl b/python/private/pypi/pip_repository.bzl index 90cda77465..597b37f52c 100644 --- a/python/private/pypi/pip_repository.bzl +++ b/python/private/pypi/pip_repository.bzl @@ -177,6 +177,7 @@ def _pip_repository_impl(rctx): pkg: [whl_alias(repo = rctx.attr.name + "_" + pkg)] for pkg in bzl_packages or [] }, + extra_hub_aliases = rctx.attr.extra_hub_aliases, ) for path, contents in aliases.items(): rctx.file(path, contents) From b85d19b85226bf134ce71d8d6f45ab5b7ea58842 Mon Sep 17 00:00:00 2001 From: Garrett Holmstrom Date: Mon, 18 Nov 2024 16:26:09 -0800 Subject: [PATCH 2/4] Update changelog and fix example MODULE.bazel.lock --- CHANGELOG.md | 2 +- examples/bzlmod/MODULE.bazel.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65a7d992cb..882270ba9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,7 +52,7 @@ Unreleased changes template. {#v0-0-0-changed} ### Changed -* Nothing changed. +* (pypi) extra_hub_aliases now works with pip_parse in WORKSPACE files. {#v0-0-0-fixed} ### Fixed diff --git a/examples/bzlmod/MODULE.bazel.lock b/examples/bzlmod/MODULE.bazel.lock index 5a546c2f7a..cf298bef27 100644 --- a/examples/bzlmod/MODULE.bazel.lock +++ b/examples/bzlmod/MODULE.bazel.lock @@ -1562,7 +1562,7 @@ }, "@@rules_python~//python/extensions:pip.bzl%pip": { "general": { - "bzlTransitiveDigest": "MwmpiMn2qoAVC+3E9MF3E98fB8v1utYBfMa0frXyi7g=", + "bzlTransitiveDigest": "aJPH/FTR96ScOnOCNzttRY0ZYlwfvo21CU1t2rCZpJE=", "usagesDigest": "VmrNvB/4EhzsYieLDka9584M+pYKPpjNLl3Wcb5rx/c=", "recordedFileInputs": { "@@//requirements_lock_3_10.txt": "5e7083982a7e60f34998579a0ae83b520d46ab8f2552cc51337217f024e6def5", @@ -7035,7 +7035,7 @@ }, "@@rules_python~//python/private/pypi:pip.bzl%pip_internal": { "general": { - "bzlTransitiveDigest": "Kx383BMHUpAHEjRiU5aWU4QTRQVg+Uu+Mgi7jVxuz0c=", + "bzlTransitiveDigest": "o7WVpo6h2GwDZVTjkmMUvNReRBGrdVboJqxnB4gRbR8=", "usagesDigest": "/lZXl/ZgP+u5PE8WkeWTyYBsvX9XQWFn1antj5qrBzQ=", "recordedFileInputs": { "@@rules_python~//tools/publish/requirements_linux.txt": "8175b4c8df50ae2f22d1706961884beeb54e7da27bd2447018314a175981997d", From 65ada63e6c0a67d059d9375476e442f250372100 Mon Sep 17 00:00:00 2001 From: Garrett Holmstrom Date: Mon, 18 Nov 2024 16:34:50 -0800 Subject: [PATCH 3/4] Placate buildifier --- CHANGELOG.md | 1 + examples/bzlmod/MODULE.bazel.lock | 4 ++-- python/private/pypi/attrs.bzl | 20 ++++++++++---------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a91855906..905dc03e53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ Unreleased changes template. {#v0-0-0-changed} ### Changed + **Breaking**: * (toolchains) stop exposing config settings in python toolchain alias repos. Please consider depending on the flags defined in diff --git a/examples/bzlmod/MODULE.bazel.lock b/examples/bzlmod/MODULE.bazel.lock index b28ee0fa37..18538d929a 100644 --- a/examples/bzlmod/MODULE.bazel.lock +++ b/examples/bzlmod/MODULE.bazel.lock @@ -1562,7 +1562,7 @@ }, "@@rules_python~//python/extensions:pip.bzl%pip": { "general": { - "bzlTransitiveDigest": "AmTe6Pi8TXCnoritG2aCWie5Tmgp/GOorsHTop4h4bw=", + "bzlTransitiveDigest": "c3HURsyNEdAN0fRo5BXiCkhhZSPfl1zNBcQOQbpgJ64=", "usagesDigest": "VmrNvB/4EhzsYieLDka9584M+pYKPpjNLl3Wcb5rx/c=", "recordedFileInputs": { "@@//requirements_lock_3_10.txt": "5e7083982a7e60f34998579a0ae83b520d46ab8f2552cc51337217f024e6def5", @@ -7035,7 +7035,7 @@ }, "@@rules_python~//python/private/pypi:pip.bzl%pip_internal": { "general": { - "bzlTransitiveDigest": "pjIqDVzRIrLhR5myqZzL9HECc2qc5Qz1e/4L8iCHE3I=", + "bzlTransitiveDigest": "H9pnwH6wHRp4Xy2CN6NSo0mDMHFDvpqspLNW6Xbqnhc=", "usagesDigest": "/lZXl/ZgP+u5PE8WkeWTyYBsvX9XQWFn1antj5qrBzQ=", "recordedFileInputs": { "@@rules_python~//tools/publish/requirements_linux.txt": "8175b4c8df50ae2f22d1706961884beeb54e7da27bd2447018314a175981997d", diff --git a/python/private/pypi/attrs.bzl b/python/private/pypi/attrs.bzl index 56b9335247..c9b7ea66a9 100644 --- a/python/private/pypi/attrs.bzl +++ b/python/private/pypi/attrs.bzl @@ -139,16 +139,6 @@ Special values: `host` (for generating deps for the host platform only) and `_*` values. For example, `cp39_*`, `linux_*`, `cp39_linux_*`. NOTE: this is not for cross-compiling Python wheels but rather for parsing the `whl` METADATA correctly. -""", - ), - "extra_pip_args": attr.string_list( - doc = """Extra arguments to pass on to pip. Must not contain spaces. - -Supports environment variables using the syntax `$VARNAME` or -`${VARNAME}` (expanding to empty string if unset) or -`${VARNAME:-default}` (expanding to default if the variable is unset -or empty in the environment), if `"VARNAME"` is listed in the -`envsubst` attribute. See also `envsubst`. """, ), "extra_hub_aliases": attr.string_list_dict( @@ -161,6 +151,16 @@ paired with the {attr}`whl_modifications`. """, mandatory = False, ), + "extra_pip_args": attr.string_list( + doc = """Extra arguments to pass on to pip. Must not contain spaces. + +Supports environment variables using the syntax `$VARNAME` or +`${VARNAME}` (expanding to empty string if unset) or +`${VARNAME:-default}` (expanding to default if the variable is unset +or empty in the environment), if `"VARNAME"` is listed in the +`envsubst` attribute. See also `envsubst`. +""", + ), "isolated": attr.bool( doc = """\ Whether or not to pass the [--isolated](https://pip.pypa.io/en/stable/cli/pip/#cmdoption-isolated) flag to From a58f0421dc20d016e4fc6861f45c8b06955949d6 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Tue, 19 Nov 2024 09:49:25 +0900 Subject: [PATCH 4/4] Update CHANGELOG.md to use sphinx links --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 905dc03e53..f067b4f698 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,7 +71,7 @@ Unreleased changes template. Other changes: * (python_repository) Start honoring the `strip_prefix` field for `zstd` archives. -* (pypi) extra_hub_aliases now works with pip_parse in WORKSPACE files. +* (pypi) {bzl:obj}`pip_parse.extra_hub_aliases` now works in WORKSPACE files. {#v0-0-0-fixed} ### Fixed