From d6b76db32968ac6fcf7f88107eddea35cca8ddcd Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Wed, 2 Sep 2026 19:57:19 -0700 Subject: [PATCH] build: move requirements update multirun from //private to //dev Move the repo-wide requirements update multirun from //private to //dev:all_requirements.update and remove the //private package. Work towards #4128 --- dev/BUILD.bazel | 49 +++++++++++++++++++++++++++ docs/devguide.md | 14 ++++---- private/BUILD.bazel | 40 ---------------------- tools/private/update_deps/BUILD.bazel | 2 +- tools/publish/BUILD.bazel | 2 +- 5 files changed, 58 insertions(+), 49 deletions(-) delete mode 100644 private/BUILD.bazel diff --git a/dev/BUILD.bazel b/dev/BUILD.bazel index 22fe5bb918..9b0e32bb71 100644 --- a/dev/BUILD.bazel +++ b/dev/BUILD.bazel @@ -1,3 +1,4 @@ +load("@rules_multirun//:defs.bzl", "multirun") load("//python/uv:lock.bzl", "lock") # buildifier: disable=bzl-visibility licenses(["notice"]) @@ -27,3 +28,51 @@ lock( python_version = "3.10", visibility = ["//:__subpackages__"], ) + +# This target runs all dev-only dependency updaters across the repo. +# Run: bazel run //dev:all_requirements.update +multirun( + name = "all_requirements.update", + commands = [ + "//tools/publish:{}.update".format(r) + for r in [ + "requirements_universal", + "requirements_darwin", + "requirements_windows", + "requirements_linux", + ] + ] + [ + ":requirements.update", + ":uv_lock.update", + "//examples:bzlmod_requirements_3_12.update", + "//examples:bzlmod_requirements_3_12_windows.update", + "//examples:bzlmod_requirements_3_13.update", + "//examples:bzlmod_requirements_3_13_windows.update", + "//examples:bzlmod_requirements_3_14.update", + "//examples:bzlmod_requirements_3_14_windows.update", + "//tests/multi_pypi/alpha:requirements.update", + "//tests/multi_pypi/beta:requirements.update", + "//tests/uv/lock/pyproject_toml:requirements.update", + "//tests/uv/lock/workspaces:requirements.update", + ], + tags = ["manual"], + visibility = ["//:__subpackages__"], +) + +alias( + name = "requirements_all.update", + actual = ":all_requirements.update", + tags = ["manual"], + visibility = ["//:__subpackages__"], +) + +# NOTE: The requirements for the pip dependencies may sometimes break the build +# process due to how `pip-compile` works (i.e. it sometimes needs to build +# wheels to resolve the `pyproject.toml` file. Hence we do not lump the +# target with the other targets above. +alias( + name = "whl_library_requirements.update", + actual = "//tools/private/update_deps:update_pip_deps", + tags = ["manual"], + visibility = ["//:__subpackages__"], +) diff --git a/docs/devguide.md b/docs/devguide.md index b886e81527..f8445ae524 100644 --- a/docs/devguide.md +++ b/docs/devguide.md @@ -95,11 +95,11 @@ integration test. 1. Modify the `./python/private/pypi/requirements.txt` file and run: ``` - bazel run //private:whl_library_requirements.update + bazel run //dev:whl_library_requirements.update ``` 1. Run the following target to update `twine` dependencies: ``` - bazel run //private:requirements.update + bazel run //dev:all_requirements.update ``` 1. Bump the coverage dependencies using the script using: ``` @@ -111,11 +111,11 @@ integration test. ## Updating tool dependencies It's suggested to routinely update the tool versions within our repo. Some of the -tools are using requirement files compiled by `uv`, and others use other means. In order -to have everything self-documented, we have a special target, -`//private:requirements.update`, which uses `rules_multirun` to run all -of the requirement-updating scripts in sequence in one go. This can be done once per release as -we prepare for releases. +tools are using requirement files compiled by `uv`, and others use other means. +In order to have everything self-documented, we have a special target, +`//dev:all_requirements.update`, which uses `rules_multirun` to run all of the +requirement-updating scripts in sequence in one go. This can be done once per +release as we prepare for releases. (creating-backport-prs)= ## Creating Backport PRs diff --git a/private/BUILD.bazel b/private/BUILD.bazel deleted file mode 100644 index 761298fbd4..0000000000 --- a/private/BUILD.bazel +++ /dev/null @@ -1,40 +0,0 @@ -load("@rules_multirun//:defs.bzl", "multirun") - -# This file has various targets that are using dev-only dependencies that our users should not ideally see. - -multirun( - name = "requirements.update", - commands = [ - "//tools/publish:{}.update".format(r) - for r in [ - "requirements_universal", - "requirements_darwin", - "requirements_windows", - "requirements_linux", - ] - ] + [ - "//dev:requirements.update", - "//dev:uv_lock.update", - "//examples:bzlmod_requirements_3_12.update", - "//examples:bzlmod_requirements_3_12_windows.update", - "//examples:bzlmod_requirements_3_13.update", - "//examples:bzlmod_requirements_3_13_windows.update", - "//examples:bzlmod_requirements_3_14.update", - "//examples:bzlmod_requirements_3_14_windows.update", - "//tests/multi_pypi/alpha:requirements.update", - "//tests/multi_pypi/beta:requirements.update", - "//tests/uv/lock/pyproject_toml:requirements.update", - "//tests/uv/lock/workspaces:requirements.update", - ], - tags = ["manual"], -) - -# NOTE: The requirements for the pip dependencies may sometimes break the build -# process due to how `pip-compile` works (i.e. it sometimes needs to build -# wheels to resolve the `pyproject.toml` file. Hence we do not lump the -# target with the other targets above. -alias( - name = "whl_library_requirements.update", - actual = "//tools/private/update_deps:update_pip_deps", - tags = ["manual"], -) diff --git a/tools/private/update_deps/BUILD.bazel b/tools/private/update_deps/BUILD.bazel index 8746d82c17..5ebb8550c1 100644 --- a/tools/private/update_deps/BUILD.bazel +++ b/tools/private/update_deps/BUILD.bazel @@ -59,7 +59,7 @@ py_binary( "REQUIREMENTS_TXT": "$(rlocationpath //python/private/pypi:requirements_txt)", }, imports = ["../../.."], - visibility = ["//private:__pkg__"], + visibility = ["//:__subpackages__"], deps = [ ":args", ":update_file", diff --git a/tools/publish/BUILD.bazel b/tools/publish/BUILD.bazel index a449405e5e..93b44b3766 100644 --- a/tools/publish/BUILD.bazel +++ b/tools/publish/BUILD.bazel @@ -38,5 +38,5 @@ publish_deps( "--emit-index-url", "--upgrade", # always upgrade ], - visibility = ["//private:__pkg__"], + visibility = ["//:__subpackages__"], )