From 11b7f407542c41f8896530a795079c150cb9c2a4 Mon Sep 17 00:00:00 2001 From: Zhongpeng Lin Date: Thu, 20 Apr 2023 14:41:13 -0700 Subject: [PATCH 01/10] Using canonical name --- python/pip_install/pip_repository.bzl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/python/pip_install/pip_repository.bzl b/python/pip_install/pip_repository.bzl index fce0dcdd47..0353372394 100644 --- a/python/pip_install/pip_repository.bzl +++ b/python/pip_install/pip_repository.bzl @@ -358,8 +358,6 @@ def _pip_repository_bzlmod_impl(rctx): bzl_packages = sorted([name for name, _ in packages]) - repo_name = rctx.attr.name.split("~")[-1] - build_contents = _BUILD_FILE_CONTENTS if rctx.attr.incompatible_generate_aliases: @@ -370,11 +368,11 @@ def _pip_repository_bzlmod_impl(rctx): rctx.file("BUILD.bazel", build_contents) rctx.template("requirements.bzl", rctx.attr._template, substitutions = { "%%ALL_REQUIREMENTS%%": _format_repr_list([ - "@{}//{}".format(repo_name, p) if rctx.attr.incompatible_generate_aliases else "@{}_{}//:pkg".format(rctx.attr.name, p) + "@@{}//{}".format(rctx.attr.name, p) if rctx.attr.incompatible_generate_aliases else "@@{}_{}//:pkg".format(rctx.attr.name, p) for p in bzl_packages ]), "%%ALL_WHL_REQUIREMENTS%%": _format_repr_list([ - "@{}//{}:whl".format(repo_name, p) if rctx.attr.incompatible_generate_aliases else "@{}_{}//:whl".format(rctx.attr.name, p) + "@@{}//{}:whl".format(rctx.attr.name, p) if rctx.attr.incompatible_generate_aliases else "@@{}_{}//:whl".format(rctx.attr.name, p) for p in bzl_packages ]), "%%NAME%%": rctx.attr.name, From 3acceff6aea4520b55d64b9b4c41b884c624caa3 Mon Sep 17 00:00:00 2001 From: Zhongpeng Lin Date: Thu, 20 Apr 2023 15:16:46 -0700 Subject: [PATCH 02/10] fixing remainining usage of repo_name --- python/pip_install/pip_repository.bzl | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/python/pip_install/pip_repository.bzl b/python/pip_install/pip_repository.bzl index 0353372394..11bf1165ad 100644 --- a/python/pip_install/pip_repository.bzl +++ b/python/pip_install/pip_repository.bzl @@ -278,27 +278,27 @@ def _pkg_aliases(rctx, repo_name, bzl_packages): alias( name = "{name}", - actual = "@{repo_name}_{dep}//:pkg", + actual = "@@{repo_name}_{dep}//:pkg", ) alias( name = "pkg", - actual = "@{repo_name}_{dep}//:pkg", + actual = "@@{repo_name}_{dep}//:pkg", ) alias( name = "whl", - actual = "@{repo_name}_{dep}//:whl", + actual = "@@{repo_name}_{dep}//:whl", ) alias( name = "data", - actual = "@{repo_name}_{dep}//:data", + actual = "@@{repo_name}_{dep}//:data", ) alias( name = "dist_info", - actual = "@{repo_name}_{dep}//:dist_info", + actual = "@@{repo_name}_{dep}//:dist_info", ) """.format( name = name, @@ -324,22 +324,22 @@ def _bzlmod_pkg_aliases(repo_name, bzl_packages): alias( name = "{name}_pkg", - actual = "@{repo_name}_{dep}//:pkg", + actual = "@@{repo_name}_{dep}//:pkg", ) alias( name = "{name}_whl", - actual = "@{repo_name}_{dep}//:whl", + actual = "@@{repo_name}_{dep}//:whl", ) alias( name = "{name}_data", - actual = "@{repo_name}_{dep}//:data", + actual = "@@{repo_name}_{dep}//:data", ) alias( name = "{name}_dist_info", - actual = "@{repo_name}_{dep}//:dist_info", + actual = "@@{repo_name}_{dep}//:dist_info", ) """.format( name = name, @@ -361,9 +361,9 @@ def _pip_repository_bzlmod_impl(rctx): build_contents = _BUILD_FILE_CONTENTS if rctx.attr.incompatible_generate_aliases: - _pkg_aliases(rctx, repo_name, bzl_packages) + _pkg_aliases(rctx, rctx.attr.name, bzl_packages) else: - build_contents += _bzlmod_pkg_aliases(repo_name, bzl_packages) + build_contents += _bzlmod_pkg_aliases(rctx.attr.name, bzl_packages) rctx.file("BUILD.bazel", build_contents) rctx.template("requirements.bzl", rctx.attr._template, substitutions = { From 8d04e173e5df54db5883265f0d1d816a7e25d791 Mon Sep 17 00:00:00 2001 From: Zhongpeng Lin Date: Thu, 20 Apr 2023 16:01:01 -0700 Subject: [PATCH 03/10] add repo_name to pip_repository_bzlmod --- python/extensions.bzl | 1 + python/pip_install/pip_repository.bzl | 32 ++++++++++++++++----------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/python/extensions.bzl b/python/extensions.bzl index 2b0c188554..a3e9c4913e 100644 --- a/python/extensions.bzl +++ b/python/extensions.bzl @@ -83,6 +83,7 @@ def _pip_impl(module_ctx): # this does not create the install_deps() macro. pip_repository_bzlmod( name = attr.name, + repo_name = attr.name, requirements_lock = attr.requirements_lock, incompatible_generate_aliases = attr.incompatible_generate_aliases, ) diff --git a/python/pip_install/pip_repository.bzl b/python/pip_install/pip_repository.bzl index 11bf1165ad..06fbabc3fd 100644 --- a/python/pip_install/pip_repository.bzl +++ b/python/pip_install/pip_repository.bzl @@ -278,27 +278,27 @@ def _pkg_aliases(rctx, repo_name, bzl_packages): alias( name = "{name}", - actual = "@@{repo_name}_{dep}//:pkg", + actual = "@{repo_name}_{dep}//:pkg", ) alias( name = "pkg", - actual = "@@{repo_name}_{dep}//:pkg", + actual = "@{repo_name}_{dep}//:pkg", ) alias( name = "whl", - actual = "@@{repo_name}_{dep}//:whl", + actual = "@{repo_name}_{dep}//:whl", ) alias( name = "data", - actual = "@@{repo_name}_{dep}//:data", + actual = "@{repo_name}_{dep}//:data", ) alias( name = "dist_info", - actual = "@@{repo_name}_{dep}//:dist_info", + actual = "@{repo_name}_{dep}//:dist_info", ) """.format( name = name, @@ -324,22 +324,22 @@ def _bzlmod_pkg_aliases(repo_name, bzl_packages): alias( name = "{name}_pkg", - actual = "@@{repo_name}_{dep}//:pkg", + actual = "@{repo_name}_{dep}//:pkg", ) alias( name = "{name}_whl", - actual = "@@{repo_name}_{dep}//:whl", + actual = "@{repo_name}_{dep}//:whl", ) alias( name = "{name}_data", - actual = "@@{repo_name}_{dep}//:data", + actual = "@{repo_name}_{dep}//:data", ) alias( name = "{name}_dist_info", - actual = "@@{repo_name}_{dep}//:dist_info", + actual = "@{repo_name}_{dep}//:dist_info", ) """.format( name = name, @@ -358,21 +358,23 @@ def _pip_repository_bzlmod_impl(rctx): bzl_packages = sorted([name for name, _ in packages]) + repo_name = rctx.attr.repo_name + build_contents = _BUILD_FILE_CONTENTS if rctx.attr.incompatible_generate_aliases: - _pkg_aliases(rctx, rctx.attr.name, bzl_packages) + _pkg_aliases(rctx, repo_name, bzl_packages) else: - build_contents += _bzlmod_pkg_aliases(rctx.attr.name, bzl_packages) + build_contents += _bzlmod_pkg_aliases(repo_name, bzl_packages) rctx.file("BUILD.bazel", build_contents) rctx.template("requirements.bzl", rctx.attr._template, substitutions = { "%%ALL_REQUIREMENTS%%": _format_repr_list([ - "@@{}//{}".format(rctx.attr.name, p) if rctx.attr.incompatible_generate_aliases else "@@{}_{}//:pkg".format(rctx.attr.name, p) + "@{}//{}".format(repo_name, p) if rctx.attr.incompatible_generate_aliases else "@{}//:{}_pkg".format(repo_name, p) for p in bzl_packages ]), "%%ALL_WHL_REQUIREMENTS%%": _format_repr_list([ - "@@{}//{}:whl".format(rctx.attr.name, p) if rctx.attr.incompatible_generate_aliases else "@@{}_{}//:whl".format(rctx.attr.name, p) + "@{}//{}:whl".format(repo_name, p) if rctx.attr.incompatible_generate_aliases else "@{}//:{}_whl".format(repo_name, p) for p in bzl_packages ]), "%%NAME%%": rctx.attr.name, @@ -380,6 +382,10 @@ def _pip_repository_bzlmod_impl(rctx): }) pip_repository_bzlmod_attrs = { + "repo_name": attr.string( + mandatory = True, + doc = "The apparent name of the repo. This is needed because in bzlmod, the name attribute becomes the canonical name", + ), "incompatible_generate_aliases": attr.bool( default = False, doc = "Allow generating aliases in '@pip//:' -> '@pip_//:pkg'. This replaces the aliases generated by the `bzlmod` tooling.", From bb83f6ca9ff4167d1c6e974c3d157f15fb2d6c28 Mon Sep 17 00:00:00 2001 From: Zhongpeng Lin Date: Thu, 20 Apr 2023 16:11:07 -0700 Subject: [PATCH 04/10] fix docs and style --- docs/pip_repository.md | 6 ++++-- python/pip_install/pip_repository.bzl | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/pip_repository.md b/docs/pip_repository.md index c02058e08d..481f70b262 100644 --- a/docs/pip_repository.md +++ b/docs/pip_repository.md @@ -85,8 +85,9 @@ py_binary( ## pip_repository_bzlmod
-pip_repository_bzlmod(name, incompatible_generate_aliases, repo_mapping, requirements_darwin,
-                      requirements_linux, requirements_lock, requirements_windows)
+pip_repository_bzlmod(name, incompatible_generate_aliases, repo_mapping, repo_name,
+                      requirements_darwin, requirements_linux, requirements_lock,
+                      requirements_windows)
 
A rule for bzlmod pip_repository creation. Intended for private use only. @@ -99,6 +100,7 @@ A rule for bzlmod pip_repository creation. Intended for private use only. | name | A unique name for this repository. | Name | required | | | incompatible_generate_aliases | Allow generating aliases in '@pip//:<pkg>' -> '@pip_<pkg>//:pkg'. This replaces the aliases generated by the bzlmod tooling. | Boolean | optional | False | | repo_mapping | A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<p>For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target). | Dictionary: String -> String | required | | +| repo_name | The apparent name of the repo. This is needed because in bzlmod, the name attribute becomes the canonical name | String | required | | | requirements_darwin | Override the requirements_lock attribute when the host platform is Mac OS | Label | optional | None | | requirements_linux | Override the requirements_lock attribute when the host platform is Linux | Label | optional | None | | requirements_lock | A fully resolved 'requirements.txt' pip requirement file containing the transitive set of your dependencies. If this file is passed instead of 'requirements' no resolve will take place and pip_repository will create individual repositories for each of your dependencies so that wheels are fetched/built only for the targets specified by 'build/run/test'. | Label | optional | None | diff --git a/python/pip_install/pip_repository.bzl b/python/pip_install/pip_repository.bzl index 06fbabc3fd..66bec32e18 100644 --- a/python/pip_install/pip_repository.bzl +++ b/python/pip_install/pip_repository.bzl @@ -382,14 +382,14 @@ def _pip_repository_bzlmod_impl(rctx): }) pip_repository_bzlmod_attrs = { - "repo_name": attr.string( - mandatory = True, - doc = "The apparent name of the repo. This is needed because in bzlmod, the name attribute becomes the canonical name", - ), "incompatible_generate_aliases": attr.bool( default = False, doc = "Allow generating aliases in '@pip//:' -> '@pip_//:pkg'. This replaces the aliases generated by the `bzlmod` tooling.", ), + "repo_name": attr.string( + mandatory = True, + doc = "The apparent name of the repo. This is needed because in bzlmod, the name attribute becomes the canonical name", + ), "requirements_darwin": attr.label( allow_single_file = True, doc = "Override the requirements_lock attribute when the host platform is Mac OS", From 70c7d47372cce33592b11ef6c4ac07febf6ae660 Mon Sep 17 00:00:00 2001 From: Zhongpeng Lin Date: Wed, 26 Apr 2023 13:55:17 -0700 Subject: [PATCH 05/10] adding tests --- examples/bzlmod/BUILD.bazel | 13 ++++++++++++- examples/bzlmod/MODULE.bazel | 4 ++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/examples/bzlmod/BUILD.bazel b/examples/bzlmod/BUILD.bazel index 7ecc035853..0ccb522250 100644 --- a/examples/bzlmod/BUILD.bazel +++ b/examples/bzlmod/BUILD.bazel @@ -1,7 +1,8 @@ -load("@pip//:requirements.bzl", "requirement") +load("@pip//:requirements.bzl", "requirement", "all_whl_requirements", "all_requirements") load("@python3_9//:defs.bzl", py_test_with_transition = "py_test") load("@rules_python//python:defs.bzl", "py_binary", "py_library", "py_test") load("@rules_python//python:pip.bzl", "compile_pip_requirements") +load("@bazel_skylib//rules:build_test.bzl", "build_test") compile_pip_requirements( name = "requirements", @@ -43,3 +44,13 @@ py_test_with_transition( main = "test.py", deps = [":lib"], ) + +build_test( + name = "all_wheels", + targets = all_whl_requirements, +) + +build_test( + name = "all_requirements", + targets = all_requirements, +) diff --git a/examples/bzlmod/MODULE.bazel b/examples/bzlmod/MODULE.bazel index ce9122810c..710127236f 100644 --- a/examples/bzlmod/MODULE.bazel +++ b/examples/bzlmod/MODULE.bazel @@ -4,6 +4,8 @@ module( compatibility_level = 1, ) +bazel_dep(name = "bazel_skylib", version = "1.4.1") + bazel_dep(name = "rules_python", version = "0.0.0") local_path_override( module_name = "rules_python", @@ -26,6 +28,8 @@ register_toolchains( pip = use_extension("@rules_python//python:extensions.bzl", "pip") pip.parse( name = "pip", + # Intentionally set it false because the "true" case is already covered by examples/build_file_generation + incompatible_generate_aliases = False, requirements_lock = "//:requirements_lock.txt", requirements_windows = "//:requirements_windows.txt", ) From be8c6ac400ffaf2e49b2d80b762dd4f603392e52 Mon Sep 17 00:00:00 2001 From: Zhongpeng Lin Date: Wed, 26 Apr 2023 14:04:49 -0700 Subject: [PATCH 06/10] buildifier --- examples/bzlmod/BUILD.bazel | 2 +- examples/bzlmod/MODULE.bazel | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/examples/bzlmod/BUILD.bazel b/examples/bzlmod/BUILD.bazel index 0ccb522250..af584e3729 100644 --- a/examples/bzlmod/BUILD.bazel +++ b/examples/bzlmod/BUILD.bazel @@ -1,4 +1,4 @@ -load("@pip//:requirements.bzl", "requirement", "all_whl_requirements", "all_requirements") +load("@pip//:requirements.bzl", "all_requirements", "all_whl_requirements", "requirement") load("@python3_9//:defs.bzl", py_test_with_transition = "py_test") load("@rules_python//python:defs.bzl", "py_binary", "py_library", "py_test") load("@rules_python//python:pip.bzl", "compile_pip_requirements") diff --git a/examples/bzlmod/MODULE.bazel b/examples/bzlmod/MODULE.bazel index 710127236f..4caf60837d 100644 --- a/examples/bzlmod/MODULE.bazel +++ b/examples/bzlmod/MODULE.bazel @@ -1,24 +1,27 @@ module( name = "example_bzlmod", - version = "0.0.0", compatibility_level = 1, + version = "0.0.0", ) bazel_dep(name = "bazel_skylib", version = "1.4.1") - bazel_dep(name = "rules_python", version = "0.0.0") + local_path_override( module_name = "rules_python", path = "../..", ) python = use_extension("@rules_python//python:extensions.bzl", "python") + python.toolchain( name = "python3_9", configure_coverage_tool = True, python_version = "3.9", ) + use_repo(python, "python3_9") + use_repo(python, "python3_9_toolchains") register_toolchains( @@ -26,6 +29,7 @@ register_toolchains( ) pip = use_extension("@rules_python//python:extensions.bzl", "pip") + pip.parse( name = "pip", # Intentionally set it false because the "true" case is already covered by examples/build_file_generation @@ -33,9 +37,11 @@ pip.parse( requirements_lock = "//:requirements_lock.txt", requirements_windows = "//:requirements_windows.txt", ) + use_repo(pip, "pip") -bazel_dep(name = "other_module", version = "", repo_name = "our_other_module") +bazel_dep(name = "other_module", repo_name = "our_other_module", version = "") + local_path_override( module_name = "other_module", path = "other_module", From 8b0ab48ef3430fdb35fe0855bb4b78a3f49122f1 Mon Sep 17 00:00:00 2001 From: Zhongpeng Lin Date: Wed, 26 Apr 2023 14:18:10 -0700 Subject: [PATCH 07/10] manually fixed load order --- examples/bzlmod/BUILD.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/bzlmod/BUILD.bazel b/examples/bzlmod/BUILD.bazel index af584e3729..3183608897 100644 --- a/examples/bzlmod/BUILD.bazel +++ b/examples/bzlmod/BUILD.bazel @@ -1,8 +1,8 @@ +load("@bazel_skylib//rules:build_test.bzl", "build_test") load("@pip//:requirements.bzl", "all_requirements", "all_whl_requirements", "requirement") load("@python3_9//:defs.bzl", py_test_with_transition = "py_test") load("@rules_python//python:defs.bzl", "py_binary", "py_library", "py_test") load("@rules_python//python:pip.bzl", "compile_pip_requirements") -load("@bazel_skylib//rules:build_test.bzl", "build_test") compile_pip_requirements( name = "requirements", From 1866bbc69c3588cbc28381a70110d84dcc01f29e Mon Sep 17 00:00:00 2001 From: Zhongpeng Lin Date: Wed, 26 Apr 2023 14:24:36 -0700 Subject: [PATCH 08/10] buildifier 6.1.0 --- examples/bzlmod/MODULE.bazel | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/examples/bzlmod/MODULE.bazel b/examples/bzlmod/MODULE.bazel index 4caf60837d..a678990e81 100644 --- a/examples/bzlmod/MODULE.bazel +++ b/examples/bzlmod/MODULE.bazel @@ -1,27 +1,23 @@ module( name = "example_bzlmod", - compatibility_level = 1, version = "0.0.0", + compatibility_level = 1, ) bazel_dep(name = "bazel_skylib", version = "1.4.1") bazel_dep(name = "rules_python", version = "0.0.0") - local_path_override( module_name = "rules_python", path = "../..", ) python = use_extension("@rules_python//python:extensions.bzl", "python") - python.toolchain( name = "python3_9", configure_coverage_tool = True, python_version = "3.9", ) - use_repo(python, "python3_9") - use_repo(python, "python3_9_toolchains") register_toolchains( @@ -29,7 +25,6 @@ register_toolchains( ) pip = use_extension("@rules_python//python:extensions.bzl", "pip") - pip.parse( name = "pip", # Intentionally set it false because the "true" case is already covered by examples/build_file_generation @@ -37,11 +32,9 @@ pip.parse( requirements_lock = "//:requirements_lock.txt", requirements_windows = "//:requirements_windows.txt", ) - use_repo(pip, "pip") -bazel_dep(name = "other_module", repo_name = "our_other_module", version = "") - +bazel_dep(name = "other_module", version = "", repo_name = "our_other_module") local_path_override( module_name = "other_module", path = "other_module", From d0b1a9f2f4f48baab40a9a291e53deb478caf4bc Mon Sep 17 00:00:00 2001 From: Zhongpeng Lin Date: Sat, 6 May 2023 21:53:51 -0700 Subject: [PATCH 09/10] use macro_tmpl --- examples/bzlmod/MODULE.bazel | 2 +- examples/bzlmod_build_file_generation/MODULE.bazel | 2 +- python/pip_install/pip_repository.bzl | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/examples/bzlmod/MODULE.bazel b/examples/bzlmod/MODULE.bazel index a678990e81..f1a70af22f 100644 --- a/examples/bzlmod/MODULE.bazel +++ b/examples/bzlmod/MODULE.bazel @@ -27,7 +27,7 @@ register_toolchains( pip = use_extension("@rules_python//python:extensions.bzl", "pip") pip.parse( name = "pip", - # Intentionally set it false because the "true" case is already covered by examples/build_file_generation + # Intentionally set it false because the "true" case is already covered by examples/bzlmod_build_file_generation incompatible_generate_aliases = False, requirements_lock = "//:requirements_lock.txt", requirements_windows = "//:requirements_windows.txt", diff --git a/examples/bzlmod_build_file_generation/MODULE.bazel b/examples/bzlmod_build_file_generation/MODULE.bazel index 781b0cba39..9a7a5d1852 100644 --- a/examples/bzlmod_build_file_generation/MODULE.bazel +++ b/examples/bzlmod_build_file_generation/MODULE.bazel @@ -86,7 +86,7 @@ pip = use_extension("@rules_python//python:extensions.bzl", "pip") # operating systems, we have requirements for each. pip.parse( name = "pip", - # When using gazelle you must use set the following flag + # When using gazelle you must set the following flag # in order for the generation of gazelle dependency resolution. incompatible_generate_aliases = True, # The interpreter attribute points to the interpreter to use for running diff --git a/python/pip_install/pip_repository.bzl b/python/pip_install/pip_repository.bzl index 971c07e52d..d73c788154 100644 --- a/python/pip_install/pip_repository.bzl +++ b/python/pip_install/pip_repository.bzl @@ -379,12 +379,11 @@ def _pip_repository_bzlmod_impl(rctx): rctx.file("BUILD.bazel", build_contents) rctx.template("requirements.bzl", rctx.attr._template, substitutions = { "%%ALL_REQUIREMENTS%%": _format_repr_list([ - "@{}//{}".format(repo_name, p) if rctx.attr.incompatible_generate_aliases else "@{}//:{}_pkg".format(repo_name, p) + macro_tmpl.format(p, p) if rctx.attr.incompatible_generate_aliases else macro_tmpl.format(p, "pkg") for p in bzl_packages ]), "%%ALL_WHL_REQUIREMENTS%%": _format_repr_list([ - "@{}//{}:whl".format(repo_name, p) if rctx.attr.incompatible_generate_aliases else "@{}//:{}_whl".format(repo_name, p) - for p in bzl_packages + macro_tmpl.format(p, "whl") for p in bzl_packages ]), "%%MACRO_TMPL%%": macro_tmpl, "%%REQUIREMENTS_LOCK%%": str(requirements_txt), From fa50dd7685ab16fbc872e83220b1247e0d037f26 Mon Sep 17 00:00:00 2001 From: Zhongpeng Lin Date: Sat, 6 May 2023 21:57:17 -0700 Subject: [PATCH 10/10] buildifier --- examples/bzlmod_build_file_generation/MODULE.bazel | 2 +- python/pip_install/pip_repository.bzl | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/bzlmod_build_file_generation/MODULE.bazel b/examples/bzlmod_build_file_generation/MODULE.bazel index 9a7a5d1852..781b0cba39 100644 --- a/examples/bzlmod_build_file_generation/MODULE.bazel +++ b/examples/bzlmod_build_file_generation/MODULE.bazel @@ -86,7 +86,7 @@ pip = use_extension("@rules_python//python:extensions.bzl", "pip") # operating systems, we have requirements for each. pip.parse( name = "pip", - # When using gazelle you must set the following flag + # When using gazelle you must use set the following flag # in order for the generation of gazelle dependency resolution. incompatible_generate_aliases = True, # The interpreter attribute points to the interpreter to use for running diff --git a/python/pip_install/pip_repository.bzl b/python/pip_install/pip_repository.bzl index d73c788154..94fdd22894 100644 --- a/python/pip_install/pip_repository.bzl +++ b/python/pip_install/pip_repository.bzl @@ -383,7 +383,8 @@ def _pip_repository_bzlmod_impl(rctx): for p in bzl_packages ]), "%%ALL_WHL_REQUIREMENTS%%": _format_repr_list([ - macro_tmpl.format(p, "whl") for p in bzl_packages + macro_tmpl.format(p, "whl") + for p in bzl_packages ]), "%%MACRO_TMPL%%": macro_tmpl, "%%REQUIREMENTS_LOCK%%": str(requirements_txt),