From 007a146748fcbbb568042d7289e94b345b2c9c5b Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sat, 16 May 2026 10:57:55 +0900 Subject: [PATCH 1/3] chore!: drop workspace testing and examples --- .bazelci/presubmit.yml | 181 ------------ .bazelrc.deleted_packages | 3 - .github/workflows/create_archive_and_notes.sh | 38 +-- WORKSPACE | 182 ------------ WORKSPACE.bzlmod | 0 examples/build_file_generation/.bazelrc | 10 - examples/build_file_generation/.gitignore | 1 - examples/build_file_generation/BUILD.bazel | 103 ------- examples/build_file_generation/README.md | 22 -- examples/build_file_generation/WORKSPACE | 134 --------- examples/build_file_generation/__init__.py | 29 -- examples/build_file_generation/__main__.py | 18 -- examples/build_file_generation/__test__.py | 31 --- .../build_file_generation/gazelle_python.yaml | 38 --- .../random_number_generator/BUILD.bazel | 18 -- .../random_number_generator/__init__.py | 13 - .../random_number_generator/__test__.py | 28 -- .../generate_random_number.py | 20 -- .../build_file_generation/requirements.in | 3 - .../requirements_lock.txt | 254 ----------------- .../requirements_windows.txt | 260 ------------------ examples/multi_python_versions/WORKSPACE | 66 ----- .../multi_python_versions/WORKSPACE.bzlmod | 0 examples/pip_parse/WORKSPACE | 65 ----- examples/pip_parse/WORKSPACE.bzlmod | 0 examples/pip_parse_vendored/.bazelrc | 10 - examples/pip_parse_vendored/.bazelversion | 1 - examples/pip_parse_vendored/.gitignore | 1 - examples/pip_parse_vendored/BUILD.bazel | 77 ------ examples/pip_parse_vendored/README.md | 30 -- examples/pip_parse_vendored/WORKSPACE | 57 ---- examples/pip_parse_vendored/requirements.bzl | 122 -------- examples/pip_parse_vendored/requirements.in | 2 - examples/pip_parse_vendored/requirements.txt | 28 -- .../test_dependency_usage.py | 12 - 35 files changed, 1 insertion(+), 1856 deletions(-) delete mode 100644 WORKSPACE.bzlmod delete mode 100644 examples/build_file_generation/.bazelrc delete mode 100644 examples/build_file_generation/.gitignore delete mode 100644 examples/build_file_generation/BUILD.bazel delete mode 100644 examples/build_file_generation/README.md delete mode 100644 examples/build_file_generation/WORKSPACE delete mode 100644 examples/build_file_generation/__init__.py delete mode 100644 examples/build_file_generation/__main__.py delete mode 100644 examples/build_file_generation/__test__.py delete mode 100644 examples/build_file_generation/gazelle_python.yaml delete mode 100644 examples/build_file_generation/random_number_generator/BUILD.bazel delete mode 100644 examples/build_file_generation/random_number_generator/__init__.py delete mode 100644 examples/build_file_generation/random_number_generator/__test__.py delete mode 100644 examples/build_file_generation/random_number_generator/generate_random_number.py delete mode 100644 examples/build_file_generation/requirements.in delete mode 100644 examples/build_file_generation/requirements_lock.txt delete mode 100644 examples/build_file_generation/requirements_windows.txt delete mode 100644 examples/multi_python_versions/WORKSPACE.bzlmod delete mode 100644 examples/pip_parse/WORKSPACE.bzlmod delete mode 100644 examples/pip_parse_vendored/.bazelrc delete mode 100644 examples/pip_parse_vendored/.bazelversion delete mode 100644 examples/pip_parse_vendored/.gitignore delete mode 100644 examples/pip_parse_vendored/BUILD.bazel delete mode 100644 examples/pip_parse_vendored/README.md delete mode 100644 examples/pip_parse_vendored/WORKSPACE delete mode 100644 examples/pip_parse_vendored/requirements.bzl delete mode 100644 examples/pip_parse_vendored/requirements.in delete mode 100644 examples/pip_parse_vendored/requirements.txt delete mode 100644 examples/pip_parse_vendored/test_dependency_usage.py diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 38d223cb8d..fa73776245 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -41,25 +41,6 @@ buildifier: - "..." test_flags: - "--test_tag_filters=-integration-test" -.common_workspace_flags_min_bazel: &common_workspace_flags_min_bazel - build_flags: - - "--experimental_repository_cache_hardlinks=false" - - "--noenable_bzlmod" - - "--build_tag_filters=-integration-test" - test_flags: - - "--noenable_bzlmod" - - "--test_tag_filters=-integration-test" -.common_workspace_flags: &common_workspace_flags - skip_in_bazel_downstream_pipeline: "Bazel 9 doesn't support workspace" - test_flags: - - "--noenable_bzlmod" - - "--enable_workspace" - - "--test_tag_filters=-integration-test" - build_flags: - - "--noenable_bzlmod" - - "--enable_workspace" - - "--build_tag_filters=-integration-test" - bazel: 7.x # NOTE: The Mac and Windows bazelinbazel jobs override parts of this config. .common_bazelinbazel_config: &common_bazelinbazel_config build_flags: @@ -154,21 +135,6 @@ tasks: name: "Gazelle: BCR, Bazel {bazel}" platform: macos_arm64 - gazelle_extension_min: - <<: *common_workspace_flags_min_bazel - <<: *minimum_supported_version - name: "Gazelle: workspace, minimum supported Bazel version" - platform: ubuntu2204 - build_targets: ["//..."] - test_targets: ["//..."] - working_directory: gazelle - gazelle_extension_workspace: - <<: *common_workspace_flags - name: "Gazelle: workspace" - platform: ubuntu2204 - build_targets: ["//..."] - test_targets: ["//..."] - working_directory: gazelle gazelle_extension: name: "Gazelle: default settings" platform: ubuntu2204 @@ -197,13 +163,6 @@ tasks: test_targets: - "//..." - ubuntu_min_workspace: - <<: *minimum_supported_version - <<: *reusable_config - <<: *common_workspace_flags_min_bazel - name: "Default: Ubuntu, workspace, minimum Bazel" - platform: ubuntu2204 - ubuntu_min_bzlmod: <<: *minimum_supported_version <<: *reusable_config @@ -239,41 +198,6 @@ tasks: test_flags: - "--keep_going" - "--test_tag_filters=-integration-test" - ubuntu_workspace: - <<: *reusable_config - <<: *common_workspace_flags - name: "Default: Ubuntu, workspace" - platform: ubuntu2204 - mac_workspace: - <<: *reusable_config - <<: *common_workspace_flags - name: "Default: Mac, workspace" - platform: macos_arm64 - windows_workspace: - <<: *reusable_config - <<: *common_workspace_flags - name: "Default: Windows, workspace" - platform: windows - # Most of tests/integration are failing on Windows w/workspace. Skip them - # for now until we can look into it. - build_targets: - - "--" - - "..." - # As a regression test for #225, check that wheel targets still build when - # their package path is qualified with the repo name. - - "@rules_python//examples/wheel/..." - build_flags: - - "--noenable_bzlmod" - - "--enable_workspace" - - "--keep_going" - - "--build_tag_filters=-integration-test" - test_targets: - - "--" - - "..." - test_flags: - - "--noenable_bzlmod" - - "--enable_workspace" - - "--test_tag_filters=-integration-test" debian: <<: *reusable_config @@ -323,38 +247,6 @@ tasks: - "--test_tag_filters=-integration-test,-acceptance-test" - "--extra_toolchains=@buildkite_config//config:cc-toolchain" - integration_test_build_file_generation_ubuntu_minimum_supported_workspace: - <<: *minimum_supported_version - <<: *reusable_build_test_all - <<: *common_workspace_flags_min_bazel - name: "examples/build_file_generation: Ubuntu, workspace, minimum Bazel" - working_directory: examples/build_file_generation - platform: ubuntu2204 - integration_test_build_file_generation_ubuntu_workspace: - <<: *reusable_build_test_all - <<: *common_workspace_flags - name: "examples/build_file_generation: Ubuntu, workspace" - working_directory: examples/build_file_generation - platform: ubuntu2204 - integration_test_build_file_generation_debian_workspace: - <<: *reusable_build_test_all - <<: *common_workspace_flags - name: "examples/build_file_generation: Debian, workspace" - working_directory: examples/build_file_generation - platform: debian11 - integration_test_build_file_generation_macos_workspace: - <<: *reusable_build_test_all - <<: *common_workspace_flags - name: "examples/build_file_generation: macOS, workspace" - working_directory: examples/build_file_generation - platform: macos_arm64 - integration_test_build_file_generation_windows_workspace: - <<: *reusable_build_test_all - <<: *common_workspace_flags - name: "examples/build_file_generation: Windows, workspace" - working_directory: examples/build_file_generation - platform: windows - integration_test_bzlmod_ubuntu_vendor: <<: *reusable_build_test_all name: "examples/bzlmod: bazel vendor" @@ -365,42 +257,6 @@ tasks: - "bazel build --vendor_dir=./vendor //..." - "rm -rf ./vendor" - integration_test_multi_python_versions_ubuntu_workspace: - <<: *reusable_build_test_all - <<: *common_workspace_flags - <<: *coverage_targets_example_multi_python - name: "examples/multi_python_versions: Ubuntu, workspace" - working_directory: examples/multi_python_versions - platform: ubuntu2204 - integration_test_multi_python_versions_debian_workspace: - <<: *reusable_build_test_all - <<: *common_workspace_flags - <<: *coverage_targets_example_multi_python - name: "examples/multi_python_versions: Debian, workspace" - working_directory: examples/multi_python_versions - platform: debian11 - integration_test_multi_python_versions_macos_workspace: - <<: *reusable_build_test_all - <<: *common_workspace_flags - <<: *coverage_targets_example_multi_python - name: "examples/multi_python_versions: MacOS, workspace" - working_directory: examples/multi_python_versions - platform: macos_arm64 - integration_test_multi_python_versions_windows_workspace: - <<: *reusable_build_test_all - <<: *common_workspace_flags - # coverage is not supported on Windows - name: "examples/multi_python_versions: Windows, workspace" - working_directory: examples/multi_python_versions - platform: windows - - integration_test_pip_parse_ubuntu_min_workspace: - <<: *minimum_supported_version - <<: *common_workspace_flags_min_bazel - <<: *reusable_build_test_all - name: "examples/pip_parse: Ubuntu, workspace, minimum supported Bazel version" - working_directory: examples/pip_parse - platform: ubuntu2204 integration_test_pip_parse_ubuntu_min_bzlmod: <<: *minimum_supported_version <<: *reusable_build_test_all @@ -429,34 +285,6 @@ tasks: working_directory: examples/pip_parse platform: windows - integration_test_pip_parse_vendored_ubuntu_min_workspace: - <<: *minimum_supported_version - <<: *common_workspace_flags_min_bazel - <<: *reusable_build_test_all - name: "examples/pip_parse_vendored: Ubuntu, workspace, minimum Bazel" - working_directory: examples/pip_parse_vendored - platform: ubuntu2204 - integration_test_pip_parse_vendored_ubuntu: - <<: *reusable_build_test_all - <<: *common_workspace_flags - name: "examples/pip_parse_vendored: Ubuntu" - working_directory: examples/pip_parse_vendored - platform: ubuntu2204 - integration_test_pip_parse_vendored_debian: - <<: *reusable_build_test_all - <<: *common_workspace_flags - name: "examples/pip_parse_vendored: Debian" - working_directory: examples/pip_parse_vendored - platform: debian11 - integration_test_pip_parse_vendored_macos: - <<: *reusable_build_test_all - <<: *common_workspace_flags - name: "examples/pip_parse_vendored: MacOS" - working_directory: examples/pip_parse_vendored - platform: macos_arm64 - # We don't run pip_parse_vendored under Windows as the file checked in is - # generated from a repository rule containing OS-specific rendered paths. - integration_test_bazelinbazel_ubuntu: <<: *common_bazelinbazel_config name: "tests/integration bazel-in-bazel: Ubuntu" @@ -557,15 +385,6 @@ tasks: - "bazel run //:os_specific_requirements.update" - "git diff --exit-code" - integration_compile_pip_requirements_test_from_external_repo_ubuntu_min_workspace: - <<: *minimum_supported_version - <<: *common_workspace_flags_min_bazel - name: "compile_pip_requirements_test_from_external_repo: Ubuntu, workspace, minimum Bazel" - working_directory: tests/integration/compile_pip_requirements_test_from_external_repo - platform: ubuntu2204 - shell_commands: - # Assert that @compile_pip_requirements//:requirements_test does the right thing. - - "bazel test @compile_pip_requirements//..." integration_compile_pip_requirements_test_from_external_repo_ubuntu_min_bzlmod: <<: *minimum_supported_version name: "compile_pip_requirements_test_from_external_repo: Ubuntu, bzlmod, minimum Bazel" diff --git a/.bazelrc.deleted_packages b/.bazelrc.deleted_packages index f4ea8527f3..c912180550 100644 --- a/.bazelrc.deleted_packages +++ b/.bazelrc.deleted_packages @@ -1,6 +1,4 @@ # Generated via './tools/update_deleted_packages.sh' -common --deleted_packages=examples/build_file_generation -common --deleted_packages=examples/build_file_generation/random_number_generator common --deleted_packages=examples/bzlmod common --deleted_packages=examples/bzlmod/entry_points common --deleted_packages=examples/bzlmod/entry_points/tests @@ -16,7 +14,6 @@ common --deleted_packages=examples/multi_python_versions/libs/my_lib common --deleted_packages=examples/multi_python_versions/requirements common --deleted_packages=examples/multi_python_versions/tests common --deleted_packages=examples/pip_parse -common --deleted_packages=examples/pip_parse_vendored common --deleted_packages=gazelle common --deleted_packages=gazelle/examples/bzlmod_build_file_generation common --deleted_packages=gazelle/examples/bzlmod_build_file_generation/other_module/other_module/pkg diff --git a/.github/workflows/create_archive_and_notes.sh b/.github/workflows/create_archive_and_notes.sh index 506e2f9784..914da77a09 100755 --- a/.github/workflows/create_archive_and_notes.sh +++ b/.github/workflows/create_archive_and_notes.sh @@ -67,41 +67,5 @@ use_repo(pip, "pypi") ## Using WORKSPACE -Paste this snippet into your \`WORKSPACE\` file: - -\`\`\`starlark -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -http_archive( - name = "rules_python", - sha256 = "${SHA}", - strip_prefix = "${PREFIX}", - url = "https://github.com/bazel-contrib/rules_python/releases/download/${TAG}/rules_python-${TAG}.tar.gz", -) - -load("@rules_python//python:repositories.bzl", "py_repositories") - -py_repositories() -\`\`\` - -### Gazelle plugin - -Paste this snippet into your \`WORKSPACE\` file: - -\`\`\`starlark -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -http_archive( - name = "rules_python_gazelle_plugin", - sha256 = "${SHA}", - strip_prefix = "${PREFIX}/gazelle", - url = "https://github.com/bazel-contrib/rules_python/releases/download/${TAG}/rules_python-${TAG}.tar.gz", -) - -# To compile the rules_python gazelle extension from source, -# we must fetch some third-party go dependencies that it uses. - -load("@rules_python_gazelle_plugin//:deps.bzl", _py_gazelle_deps = "gazelle_deps") - -_py_gazelle_deps() -\`\`\` +The support for WORKSPACE has been dropped, the latest release that supports it is 2.0. Please update to bzlmod. EOF diff --git a/WORKSPACE b/WORKSPACE index 077ddb5e68..e69de29bb2 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,182 +0,0 @@ -# Copyright 2017 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -workspace(name = "rules_python") - -# Everything below this line is used only for developing rules_python. Users -# should not copy it to their WORKSPACE. - -# Necessary so that Bazel 9 recognizes this as rules_python and doesn't try -# to load the version Bazel itself uses by default. -# buildifier: disable=duplicated-name -local_repository( - name = "rules_python", - path = ".", -) - -load("//:internal_dev_deps.bzl", "rules_python_internal_deps") - -rules_python_internal_deps() - -load("@rules_java//java:rules_java_deps.bzl", "rules_java_dependencies") - -rules_java_dependencies() - -# note that the following line is what is minimally required from protobuf for the java rules -# consider using the protobuf_deps() public API from @com_google_protobuf//:protobuf_deps.bzl -load("@com_google_protobuf//bazel/private:proto_bazel_features.bzl", "proto_bazel_features") # buildifier: disable=bzl-visibility - -proto_bazel_features(name = "proto_bazel_features") - -# register toolchains -load("@rules_java//java:repositories.bzl", "rules_java_toolchains") - -rules_java_toolchains() - -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") - -protobuf_deps() - -load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps") - -rules_jvm_external_deps() - -load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup") - -rules_jvm_external_setup() - -load("@io_bazel_stardoc//:deps.bzl", "stardoc_external_deps") - -stardoc_external_deps() - -load("@stardoc_maven//:defs.bzl", stardoc_pinned_maven_install = "pinned_maven_install") - -stardoc_pinned_maven_install() - -load("//:internal_dev_setup.bzl", "rules_python_internal_setup") - -rules_python_internal_setup() - -load("@pythons_hub//:versions.bzl", "PYTHON_VERSIONS") -load("//python:repositories.bzl", "py_repositories", "python_register_multi_toolchains") - -py_repositories() - -python_register_multi_toolchains( - name = "python", - default_version = "3.11", - # Integration tests verify each version, so register all of them. - python_versions = PYTHON_VERSIONS, -) - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -# Used for Bazel CI -http_archive( - name = "bazelci_rules", - sha256 = "eca21884e6f66a88c358e580fd67a6b148d30ab57b1680f62a96c00f9bc6a07e", - strip_prefix = "bazelci_rules-1.0.0", - url = "https://github.com/bazelbuild/continuous-integration/releases/download/rules-1.0.0/bazelci_rules-1.0.0.tar.gz", -) - -load("@bazelci_rules//:rbe_repo.bzl", "rbe_preconfig") - -# Creates a default toolchain config for RBE. -# Use this as is if you are using the rbe_ubuntu16_04 container, -# otherwise refer to RBE docs. -rbe_preconfig( - name = "buildkite_config", - toolchain = "ubuntu2204", -) - -local_repository( - name = "rules_python_gazelle_plugin", - path = "gazelle", -) - -# The rules_python gazelle extension has some third-party go dependencies -# which we need to fetch in order to compile it. -load("@rules_python_gazelle_plugin//:deps.bzl", _py_gazelle_deps = "gazelle_deps") - -# See: https://github.com/bazel-contrib/rules_python/blob/main/gazelle/README.md -# This rule loads and compiles various go dependencies that running gazelle -# for python requirements. -_py_gazelle_deps() - -# This interpreter is used for various rules_python dev-time tools -interpreter = "@python_3_11_9_host//:python" - -##################### -# Install twine for our own runfiles wheel publishing. -# Eventually we might want to install twine automatically for users too, see: -# https://github.com/bazel-contrib/rules_python/issues/1016. -load("@rules_python//python:pip.bzl", "pip_parse") - -pip_parse( - name = "rules_python_publish_deps", - python_interpreter_target = interpreter, - requirements_darwin = "//tools/publish:requirements_darwin.txt", - requirements_lock = "//tools/publish:requirements_linux.txt", - requirements_windows = "//tools/publish:requirements_windows.txt", -) - -load("@rules_python_publish_deps//:requirements.bzl", "install_deps") - -install_deps() - -pip_parse( - name = "pypiserver", - python_interpreter_target = interpreter, - requirements_lock = "//examples/wheel:requirements_server.txt", -) - -load("@pypiserver//:requirements.bzl", install_pypiserver = "install_deps") - -install_pypiserver() - -##################### -# Install sphinx for doc generation. - -pip_parse( - name = "dev_pip", - python_interpreter_target = interpreter, - requirements_lock = "//docs:requirements.txt", -) - -load("@dev_pip//:requirements.bzl", docs_install_deps = "install_deps") - -docs_install_deps() - -##################### -# Pypi repos for //tests/multi_pypi - -pip_parse( - name = "pypi_alpha", - python_interpreter_target = interpreter, - requirements_lock = "//tests/multi_pypi/alpha:requirements.txt", -) - -load("@pypi_alpha//:requirements.bzl", pypi_alpha_install_deps = "install_deps") - -pypi_alpha_install_deps() - -pip_parse( - name = "pypi_beta", - python_interpreter_target = interpreter, - requirements_lock = "//tests/multi_pypi/beta:requirements.txt", -) - -load("@pypi_beta//:requirements.bzl", pypi_beta_install_deps = "install_deps") - -pypi_beta_install_deps() diff --git a/WORKSPACE.bzlmod b/WORKSPACE.bzlmod deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/examples/build_file_generation/.bazelrc b/examples/build_file_generation/.bazelrc deleted file mode 100644 index f1ae44fac8..0000000000 --- a/examples/build_file_generation/.bazelrc +++ /dev/null @@ -1,10 +0,0 @@ -test --test_output=errors --enable_runfiles - -# Windows requires these for multi-python support: -build --enable_runfiles - -# The bzlmod version of this example is in gazelle/examples/bzlmod_build_file_generation -# Once WORKSPACE support is dropped, this example can be entirely deleted. -common --noenable_bzlmod -common --enable_workspace -common --incompatible_python_disallow_native_rules diff --git a/examples/build_file_generation/.gitignore b/examples/build_file_generation/.gitignore deleted file mode 100644 index ac51a054d2..0000000000 --- a/examples/build_file_generation/.gitignore +++ /dev/null @@ -1 +0,0 @@ -bazel-* diff --git a/examples/build_file_generation/BUILD.bazel b/examples/build_file_generation/BUILD.bazel deleted file mode 100644 index a378775968..0000000000 --- a/examples/build_file_generation/BUILD.bazel +++ /dev/null @@ -1,103 +0,0 @@ -# Load various rules so that we can have bazel download -# various rulesets and dependencies. -# The `load` statement imports the symbol for the rule, in the defined -# ruleset. When the symbol is loaded you can use the rule. -load("@bazel_gazelle//:def.bzl", "gazelle") -load("@pip//:requirements.bzl", "all_whl_requirements") -load("@rules_python//python:pip.bzl", "compile_pip_requirements") -load("@rules_python//python:py_binary.bzl", "py_binary") -load("@rules_python//python:py_library.bzl", "py_library") -load("@rules_python//python:py_test.bzl", "py_test") -load("@rules_python_gazelle_plugin//manifest:defs.bzl", "gazelle_python_manifest") -load("@rules_python_gazelle_plugin//modules_mapping:def.bzl", "modules_mapping") - -compile_pip_requirements( - name = "requirements", - src = "requirements.in", - requirements_txt = "requirements_lock.txt", - requirements_windows = "requirements_windows.txt", -) - -# This repository rule fetches the metadata for python packages we -# depend on. That data is required for the gazelle_python_manifest -# rule to update our manifest file. -# To see what this rule does, try `bazel run @modules_map//:print` -modules_mapping( - name = "modules_map", - exclude_patterns = [ - "^_|(\\._)+", # This is the default. - "(\\.tests)+", # Add a custom one to get rid of the psutil tests. - ], - wheels = all_whl_requirements, -) - -# Gazelle python extension needs a manifest file mapping from -# an import to the installed package that provides it. -# This macro produces two targets: -# - //:gazelle_python_manifest.update can be used with `bazel run` -# to recalculate the manifest -# - //:gazelle_python_manifest.test is a test target ensuring that -# the manifest doesn't need to be updated -gazelle_python_manifest( - name = "gazelle_python_manifest", - modules_mapping = ":modules_map", - pip_repository_name = "pip", - # NOTE: We can pass a list just like in `bzlmod_build_file_generation` example - # but we keep a single target here for regression testing. - requirements = "//:requirements_lock.txt", -) - -# Our gazelle target points to the python gazelle binary. -# This is the simple case where we only need one language supported. -# If you also had proto, go, or other gazelle-supported languages, -# you would also need a gazelle_binary rule. -# See https://github.com/bazelbuild/bazel-gazelle/blob/master/extend.rst#example -gazelle( - name = "gazelle", - gazelle = "@rules_python_gazelle_plugin//python:gazelle_binary", -) - -# This rule is auto-generated and managed by Gazelle, -# because it found the __init__.py file in this folder. -# See: https://bazel.build/reference/be/python#py_library -py_library( - name = "build_file_generation", - srcs = ["__init__.py"], - visibility = ["//:__subpackages__"], - deps = [ - "//random_number_generator", - "@pip//flask", - "@pip//sphinx", - ], -) - -# A py_binary is an executable Python program consisting of a collection of .py source files. -# See: https://bazel.build/reference/be/python#py_binary -# -# This rule is auto-generated and managed by Gazelle, -# because it found the __main__.py file in this folder. -# This rule creates a target named //:build_file_generation_bin and you can use -# bazel to run the target: -# `bazel run //:build_file_generation_bin` -py_binary( - name = "build_file_generation_bin", - srcs = ["__main__.py"], - main = "__main__.py", - visibility = ["//:__subpackages__"], - deps = [":build_file_generation"], -) - -# A py_test is a Python unit test. -# See: https://bazel.build/reference/be/python#py_test -# -# This rule is auto-generated and managed by Gazelle, -# because it found the __test__.py file in this folder. -# This rule creates a target named //:build_file_generation_test and you can use -# bazel to run the target: -# `bazel test //:build_file_generation_test` -py_test( - name = "build_file_generation_test", - srcs = ["__test__.py"], - main = "__test__.py", - deps = [":build_file_generation"], -) diff --git a/examples/build_file_generation/README.md b/examples/build_file_generation/README.md deleted file mode 100644 index cd3cd1f109..0000000000 --- a/examples/build_file_generation/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# Build file generation with Gazelle - -This example shows a project that has Gazelle setup with the rules_python -extension, so that targets like `py_library` and `py_binary` can be -automatically created just by running - -```sh -bazel run //:requirements.update -bazel run //:gazelle_python_manifest.update -bazel run //:gazelle -``` - -As a demo, try creating a `__main__.py` file in this directory, then -re-run that gazelle command. You'll see that a `py_binary` target -is created in the `BUILD` file. - -Or, try importing the `requests` library in `__init__.py`. -You'll see that `deps = ["@pip//pypi__requests"]` is automatically -added to the `py_library` target in the `BUILD` file. - -For more information on the behavior of the rules_python gazelle extension, -see the README.md file in the /gazelle folder. diff --git a/examples/build_file_generation/WORKSPACE b/examples/build_file_generation/WORKSPACE deleted file mode 100644 index 27d0d13b7c..0000000000 --- a/examples/build_file_generation/WORKSPACE +++ /dev/null @@ -1,134 +0,0 @@ -# Set the name of the bazel workspace. -workspace(name = "build_file_generation_example") - -# Load the http_archive rule so that we can have bazel download -# various rulesets and dependencies. -# The `load` statement imports the symbol for http_archive from the http.bzl -# file. When the symbol is loaded you can use the rule. -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -# Setup rules_python. - -# DON'T COPY_PASTE THIS. -# Our example uses `local_repository` to point to the HEAD version of rules_python. -# Users should instead use the installation instructions from the release they use. -# See https://github.com/bazel-contrib/rules_python/releases -local_repository( - name = "rules_python", - path = "../..", -) - -local_repository( - name = "rules_python_gazelle_plugin", - path = "../../gazelle", -) - -# Next we load the setup and toolchain from rules_python. -load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains") - -# Perform general setup -py_repositories() - -# We now register a hermetic Python interpreter rather than relying on a system-installed interpreter. -# This toolchain will allow bazel to download a specific python version, and use that version -# for compilation. -python_register_toolchains( - name = "python39", - python_version = "3.9", -) - -load("@rules_python//python:pip.bzl", "pip_parse") - -# This macro wraps the `pip_repository` rule that invokes `pip`, with `incremental` set. -# Accepts a locked/compiled requirements file and installs the dependencies listed within. -# Those dependencies become available in a generated `requirements.bzl` file. -# You can instead check this `requirements.bzl` file into your repo. -pip_parse( - name = "pip", - - # Requirement groups allow Bazel to tolerate PyPi cycles by putting dependencies - # which are known to form cycles into groups together. - experimental_requirement_cycles = { - "sphinx": [ - "sphinx", - "sphinxcontrib-qthelp", - "sphinxcontrib-htmlhelp", - "sphinxcontrib-devhelp", - "sphinxcontrib-applehelp", - "sphinxcontrib-serializinghtml", - ], - }, - # (Optional) You can provide a python_interpreter (path) or a python_interpreter_target (a Bazel target, that - # acts as an executable). The latter can be anything that could be used as Python interpreter. E.g.: - # 1. Python interpreter that you compile in the build file. - # 2. Pre-compiled python interpreter included with http_archive. - # 3. Wrapper script, like in the autodetecting python toolchain. - # - # Here, we use the interpreter constant that resolves to the host interpreter from the default Python toolchain. - python_interpreter_target = "@python39_host//:python", - # Set the location of the lock file. - requirements_lock = "//:requirements_lock.txt", - requirements_windows = "//:requirements_windows.txt", -) - -# Load the install_deps macro. -load("@pip//:requirements.bzl", "install_deps") - -# Initialize repositories for all packages in requirements_lock.txt. -install_deps() - -###################################################################### -# We need rules_go and bazel_gazelle, to build the gazelle plugin from source. -# Setup instructions for this section are at -# https://github.com/bazelbuild/bazel-gazelle#running-gazelle-with-bazel -# You may need to update the version of the rule, which is listed in the above -# documentation. -###################################################################### - -# Define an http_archive rule that will download the below ruleset, -# test the sha, and extract the ruleset to you local bazel cache. - -http_archive( - name = "io_bazel_rules_go", - sha256 = "9d72f7b8904128afb98d46bbef82ad7223ec9ff3718d419afb355fddd9f9484a", - urls = [ - "https://mirror.bazel.build/github.com/bazel-contrib/rules_go/releases/download/v0.55.1/rules_go-v0.55.1.zip", - "https://github.com/bazel-contrib/rules_go/releases/download/v0.55.1/rules_go-v0.55.1.zip", - ], -) - -# Download the bazel_gazelle ruleset. -http_archive( - name = "bazel_gazelle", - sha256 = "75df288c4b31c81eb50f51e2e14f4763cb7548daae126817247064637fd9ea62", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.36.0/bazel-gazelle-v0.36.0.tar.gz", - "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.36.0/bazel-gazelle-v0.36.0.tar.gz", - ], -) - -# Load rules_go ruleset and expose the toolchain and dep rules. -load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") -load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") - -# go_rules_dependencies is a function that registers external dependencies -# needed by the Go rules. -# See: https://github.com/bazelbuild/rules_go/blob/master/go/dependencies.rst#go_rules_dependencies -go_rules_dependencies() - -# go_rules_dependencies is a function that registers external dependencies -# needed by the Go rules. -# See: https://github.com/bazelbuild/rules_go/blob/master/go/dependencies.rst#go_rules_dependencies -go_register_toolchains(version = "1.21.13") - -# The following call configured the gazelle dependencies, Go environment and Go SDK. -gazelle_dependencies() - -# The rules_python gazelle extension has some third-party go dependencies -# which we need to fetch in order to compile it. -load("@rules_python_gazelle_plugin//:deps.bzl", _py_gazelle_deps = "gazelle_deps") - -# See: https://github.com/bazel-contrib/rules_python/blob/main/gazelle/README.md -# This rule loads and compiles various go dependencies that running gazelle -# for python requirements. -_py_gazelle_deps() diff --git a/examples/build_file_generation/__init__.py b/examples/build_file_generation/__init__.py deleted file mode 100644 index 22e42212de..0000000000 --- a/examples/build_file_generation/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2022 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import sphinx # noqa -from flask import Flask, jsonify -from random_number_generator import generate_random_number - -app = Flask(__name__) - - -@app.route("/random-number", methods=["GET"]) -def get_random_number(): - return jsonify({"number": generate_random_number.generate_random_number()}) - - -def main(): - """Start the python web server""" - app.run() diff --git a/examples/build_file_generation/__main__.py b/examples/build_file_generation/__main__.py deleted file mode 100644 index a77055f2d5..0000000000 --- a/examples/build_file_generation/__main__.py +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright 2022 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from __init__ import main - -if __name__ == "__main__": - main() diff --git a/examples/build_file_generation/__test__.py b/examples/build_file_generation/__test__.py deleted file mode 100644 index 45e127bab8..0000000000 --- a/examples/build_file_generation/__test__.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2022 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import unittest - -from __init__ import app - - -class TestServer(unittest.TestCase): - def setUp(self): - self.app = app.test_client() - - def test_get_random_number(self): - response = self.app.get("/random-number") - self.assertEqual(response.status_code, 200) - self.assertIn("number", response.json) - - -if __name__ == "__main__": - unittest.main() diff --git a/examples/build_file_generation/gazelle_python.yaml b/examples/build_file_generation/gazelle_python.yaml deleted file mode 100644 index 6b34f3c688..0000000000 --- a/examples/build_file_generation/gazelle_python.yaml +++ /dev/null @@ -1,38 +0,0 @@ -# GENERATED FILE - DO NOT EDIT! -# -# To update this file, run: -# bazel run //:gazelle_python_manifest.update - ---- -manifest: - modules_mapping: - alabaster: alabaster - babel: Babel - certifi: certifi - charset_normalizer: charset_normalizer - click: click - docutils: docutils - flask: Flask - idna: idna - imagesize: imagesize - importlib_metadata: importlib_metadata - itsdangerous: itsdangerous - jinja2: Jinja2 - markupsafe: MarkupSafe - packaging: packaging - pygments: Pygments - requests: requests - snowballstemmer: snowballstemmer - sphinx: sphinx - sphinxcontrib.applehelp: sphinxcontrib_applehelp - sphinxcontrib.devhelp: sphinxcontrib_devhelp - sphinxcontrib.htmlhelp: sphinxcontrib_htmlhelp - sphinxcontrib.jsmath: sphinxcontrib_jsmath - sphinxcontrib.qthelp: sphinxcontrib_qthelp - sphinxcontrib.serializinghtml: sphinxcontrib_serializinghtml - urllib3: urllib3 - werkzeug: Werkzeug - zipp: zipp - pip_repository: - name: pip -integrity: 19c0e03a9cf1d6bbb2dfe301325fefc59a30c3f967f84c2f1baaf915c2805da7 diff --git a/examples/build_file_generation/random_number_generator/BUILD.bazel b/examples/build_file_generation/random_number_generator/BUILD.bazel deleted file mode 100644 index c77550084f..0000000000 --- a/examples/build_file_generation/random_number_generator/BUILD.bazel +++ /dev/null @@ -1,18 +0,0 @@ -load("@rules_python//python:py_library.bzl", "py_library") -load("@rules_python//python:py_test.bzl", "py_test") - -py_library( - name = "random_number_generator", - srcs = [ - "__init__.py", - "generate_random_number.py", - ], - visibility = ["//:__subpackages__"], -) - -py_test( - name = "random_number_generator_test", - srcs = ["__test__.py"], - main = "__test__.py", - deps = [":random_number_generator"], -) diff --git a/examples/build_file_generation/random_number_generator/__init__.py b/examples/build_file_generation/random_number_generator/__init__.py deleted file mode 100644 index 41010956cf..0000000000 --- a/examples/build_file_generation/random_number_generator/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 2023 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. diff --git a/examples/build_file_generation/random_number_generator/__test__.py b/examples/build_file_generation/random_number_generator/__test__.py deleted file mode 100644 index 5facfeee9e..0000000000 --- a/examples/build_file_generation/random_number_generator/__test__.py +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 2022 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import unittest - -import random_number_generator.generate_random_number as generate_random_number - - -class TestRandomNumberGenerator(unittest.TestCase): - def test_generate_random_number(self): - number = generate_random_number.generate_random_number() - self.assertGreaterEqual(number, 1) - self.assertLessEqual(number, 10) - - -if __name__ == "__main__": - unittest.main() diff --git a/examples/build_file_generation/random_number_generator/generate_random_number.py b/examples/build_file_generation/random_number_generator/generate_random_number.py deleted file mode 100644 index d551e3367f..0000000000 --- a/examples/build_file_generation/random_number_generator/generate_random_number.py +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2022 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import random - - -def generate_random_number(): - """Generate a random number""" - return random.randint(1, 10) diff --git a/examples/build_file_generation/requirements.in b/examples/build_file_generation/requirements.in deleted file mode 100644 index d1380fa948..0000000000 --- a/examples/build_file_generation/requirements.in +++ /dev/null @@ -1,3 +0,0 @@ -flask -sphinx -sphinxcontrib-serializinghtml diff --git a/examples/build_file_generation/requirements_lock.txt b/examples/build_file_generation/requirements_lock.txt deleted file mode 100644 index 995a56a28e..0000000000 --- a/examples/build_file_generation/requirements_lock.txt +++ /dev/null @@ -1,254 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.9 -# by the following command: -# -# bazel run //:requirements.update -# -alabaster==0.7.13 \ - --hash=sha256:1ee19aca801bbabb5ba3f5f258e4422dfa86f82f3e9cefb0859b283cdd7f62a3 \ - --hash=sha256:a27a4a084d5e690e16e01e03ad2b2e552c61a65469419b907243193de1a84ae2 - # via sphinx -babel==2.13.1 \ - --hash=sha256:33e0952d7dd6374af8dbf6768cc4ddf3ccfefc244f9986d4074704f2fbd18900 \ - --hash=sha256:7077a4984b02b6727ac10f1f7294484f737443d7e2e66c5e4380e41a3ae0b4ed - # via sphinx -certifi==2023.7.22 \ - --hash=sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082 \ - --hash=sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9 - # via requests -charset-normalizer==3.3.1 \ - --hash=sha256:06cf46bdff72f58645434d467bf5228080801298fbba19fe268a01b4534467f5 \ - --hash=sha256:0c8c61fb505c7dad1d251c284e712d4e0372cef3b067f7ddf82a7fa82e1e9a93 \ - --hash=sha256:10b8dd31e10f32410751b3430996f9807fc4d1587ca69772e2aa940a82ab571a \ - --hash=sha256:1171ef1fc5ab4693c5d151ae0fdad7f7349920eabbaca6271f95969fa0756c2d \ - --hash=sha256:17a866d61259c7de1bdadef418a37755050ddb4b922df8b356503234fff7932c \ - --hash=sha256:1d6bfc32a68bc0933819cfdfe45f9abc3cae3877e1d90aac7259d57e6e0f85b1 \ - --hash=sha256:1ec937546cad86d0dce5396748bf392bb7b62a9eeb8c66efac60e947697f0e58 \ - --hash=sha256:223b4d54561c01048f657fa6ce41461d5ad8ff128b9678cfe8b2ecd951e3f8a2 \ - --hash=sha256:2465aa50c9299d615d757c1c888bc6fef384b7c4aec81c05a0172b4400f98557 \ - --hash=sha256:28f512b9a33235545fbbdac6a330a510b63be278a50071a336afc1b78781b147 \ - --hash=sha256:2c092be3885a1b7899cd85ce24acedc1034199d6fca1483fa2c3a35c86e43041 \ - --hash=sha256:2c4c99f98fc3a1835af8179dcc9013f93594d0670e2fa80c83aa36346ee763d2 \ - --hash=sha256:31445f38053476a0c4e6d12b047b08ced81e2c7c712e5a1ad97bc913256f91b2 \ - --hash=sha256:31bbaba7218904d2eabecf4feec0d07469284e952a27400f23b6628439439fa7 \ - --hash=sha256:34d95638ff3613849f473afc33f65c401a89f3b9528d0d213c7037c398a51296 \ - --hash=sha256:352a88c3df0d1fa886562384b86f9a9e27563d4704ee0e9d56ec6fcd270ea690 \ - --hash=sha256:39b70a6f88eebe239fa775190796d55a33cfb6d36b9ffdd37843f7c4c1b5dc67 \ - --hash=sha256:3c66df3f41abee950d6638adc7eac4730a306b022570f71dd0bd6ba53503ab57 \ - --hash=sha256:3f70fd716855cd3b855316b226a1ac8bdb3caf4f7ea96edcccc6f484217c9597 \ - --hash=sha256:3f9bc2ce123637a60ebe819f9fccc614da1bcc05798bbbaf2dd4ec91f3e08846 \ - --hash=sha256:3fb765362688821404ad6cf86772fc54993ec11577cd5a92ac44b4c2ba52155b \ - --hash=sha256:45f053a0ece92c734d874861ffe6e3cc92150e32136dd59ab1fb070575189c97 \ - --hash=sha256:46fb9970aa5eeca547d7aa0de5d4b124a288b42eaefac677bde805013c95725c \ - --hash=sha256:4cb50a0335382aac15c31b61d8531bc9bb657cfd848b1d7158009472189f3d62 \ - --hash=sha256:4e12f8ee80aa35e746230a2af83e81bd6b52daa92a8afaef4fea4a2ce9b9f4fa \ - --hash=sha256:4f3100d86dcd03c03f7e9c3fdb23d92e32abbca07e7c13ebd7ddfbcb06f5991f \ - --hash=sha256:4f6e2a839f83a6a76854d12dbebde50e4b1afa63e27761549d006fa53e9aa80e \ - --hash=sha256:4f861d94c2a450b974b86093c6c027888627b8082f1299dfd5a4bae8e2292821 \ - --hash=sha256:501adc5eb6cd5f40a6f77fbd90e5ab915c8fd6e8c614af2db5561e16c600d6f3 \ - --hash=sha256:520b7a142d2524f999447b3a0cf95115df81c4f33003c51a6ab637cbda9d0bf4 \ - --hash=sha256:548eefad783ed787b38cb6f9a574bd8664468cc76d1538215d510a3cd41406cb \ - --hash=sha256:555fe186da0068d3354cdf4bbcbc609b0ecae4d04c921cc13e209eece7720727 \ - --hash=sha256:55602981b2dbf8184c098bc10287e8c245e351cd4fdcad050bd7199d5a8bf514 \ - --hash=sha256:58e875eb7016fd014c0eea46c6fa92b87b62c0cb31b9feae25cbbe62c919f54d \ - --hash=sha256:5a3580a4fdc4ac05f9e53c57f965e3594b2f99796231380adb2baaab96e22761 \ - --hash=sha256:5b70bab78accbc672f50e878a5b73ca692f45f5b5e25c8066d748c09405e6a55 \ - --hash=sha256:5ceca5876032362ae73b83347be8b5dbd2d1faf3358deb38c9c88776779b2e2f \ - --hash=sha256:61f1e3fb621f5420523abb71f5771a204b33c21d31e7d9d86881b2cffe92c47c \ - --hash=sha256:633968254f8d421e70f91c6ebe71ed0ab140220469cf87a9857e21c16687c034 \ - --hash=sha256:63a6f59e2d01310f754c270e4a257426fe5a591dc487f1983b3bbe793cf6bac6 \ - --hash=sha256:63accd11149c0f9a99e3bc095bbdb5a464862d77a7e309ad5938fbc8721235ae \ - --hash=sha256:6db3cfb9b4fcecb4390db154e75b49578c87a3b9979b40cdf90d7e4b945656e1 \ - --hash=sha256:71ef3b9be10070360f289aea4838c784f8b851be3ba58cf796262b57775c2f14 \ - --hash=sha256:7ae8e5142dcc7a49168f4055255dbcced01dc1714a90a21f87448dc8d90617d1 \ - --hash=sha256:7b6cefa579e1237ce198619b76eaa148b71894fb0d6bcf9024460f9bf30fd228 \ - --hash=sha256:800561453acdecedaac137bf09cd719c7a440b6800ec182f077bb8e7025fb708 \ - --hash=sha256:82ca51ff0fc5b641a2d4e1cc8c5ff108699b7a56d7f3ad6f6da9dbb6f0145b48 \ - --hash=sha256:851cf693fb3aaef71031237cd68699dded198657ec1e76a76eb8be58c03a5d1f \ - --hash=sha256:854cc74367180beb327ab9d00f964f6d91da06450b0855cbbb09187bcdb02de5 \ - --hash=sha256:87071618d3d8ec8b186d53cb6e66955ef2a0e4fa63ccd3709c0c90ac5a43520f \ - --hash=sha256:871d045d6ccc181fd863a3cd66ee8e395523ebfbc57f85f91f035f50cee8e3d4 \ - --hash=sha256:8aee051c89e13565c6bd366813c386939f8e928af93c29fda4af86d25b73d8f8 \ - --hash=sha256:8af5a8917b8af42295e86b64903156b4f110a30dca5f3b5aedea123fbd638bff \ - --hash=sha256:8ec8ef42c6cd5856a7613dcd1eaf21e5573b2185263d87d27c8edcae33b62a61 \ - --hash=sha256:91e43805ccafa0a91831f9cd5443aa34528c0c3f2cc48c4cb3d9a7721053874b \ - --hash=sha256:9505dc359edb6a330efcd2be825fdb73ee3e628d9010597aa1aee5aa63442e97 \ - --hash=sha256:985c7965f62f6f32bf432e2681173db41336a9c2611693247069288bcb0c7f8b \ - --hash=sha256:9a74041ba0bfa9bc9b9bb2cd3238a6ab3b7618e759b41bd15b5f6ad958d17605 \ - --hash=sha256:9edbe6a5bf8b56a4a84533ba2b2f489d0046e755c29616ef8830f9e7d9cf5728 \ - --hash=sha256:a15c1fe6d26e83fd2e5972425a772cca158eae58b05d4a25a4e474c221053e2d \ - --hash=sha256:a66bcdf19c1a523e41b8e9d53d0cedbfbac2e93c649a2e9502cb26c014d0980c \ - --hash=sha256:ae4070f741f8d809075ef697877fd350ecf0b7c5837ed68738607ee0a2c572cf \ - --hash=sha256:ae55d592b02c4349525b6ed8f74c692509e5adffa842e582c0f861751701a673 \ - --hash=sha256:b578cbe580e3b41ad17b1c428f382c814b32a6ce90f2d8e39e2e635d49e498d1 \ - --hash=sha256:b891a2f68e09c5ef989007fac11476ed33c5c9994449a4e2c3386529d703dc8b \ - --hash=sha256:baec8148d6b8bd5cee1ae138ba658c71f5b03e0d69d5907703e3e1df96db5e41 \ - --hash=sha256:bb06098d019766ca16fc915ecaa455c1f1cd594204e7f840cd6258237b5079a8 \ - --hash=sha256:bc791ec3fd0c4309a753f95bb6c749ef0d8ea3aea91f07ee1cf06b7b02118f2f \ - --hash=sha256:bd28b31730f0e982ace8663d108e01199098432a30a4c410d06fe08fdb9e93f4 \ - --hash=sha256:be4d9c2770044a59715eb57c1144dedea7c5d5ae80c68fb9959515037cde2008 \ - --hash=sha256:c0c72d34e7de5604df0fde3644cc079feee5e55464967d10b24b1de268deceb9 \ - --hash=sha256:c0e842112fe3f1a4ffcf64b06dc4c61a88441c2f02f373367f7b4c1aa9be2ad5 \ - --hash=sha256:c15070ebf11b8b7fd1bfff7217e9324963c82dbdf6182ff7050519e350e7ad9f \ - --hash=sha256:c2000c54c395d9e5e44c99dc7c20a64dc371f777faf8bae4919ad3e99ce5253e \ - --hash=sha256:c30187840d36d0ba2893bc3271a36a517a717f9fd383a98e2697ee890a37c273 \ - --hash=sha256:cb7cd68814308aade9d0c93c5bd2ade9f9441666f8ba5aa9c2d4b389cb5e2a45 \ - --hash=sha256:cd805513198304026bd379d1d516afbf6c3c13f4382134a2c526b8b854da1c2e \ - --hash=sha256:d0bf89afcbcf4d1bb2652f6580e5e55a840fdf87384f6063c4a4f0c95e378656 \ - --hash=sha256:d9137a876020661972ca6eec0766d81aef8a5627df628b664b234b73396e727e \ - --hash=sha256:dbd95e300367aa0827496fe75a1766d198d34385a58f97683fe6e07f89ca3e3c \ - --hash=sha256:dced27917823df984fe0c80a5c4ad75cf58df0fbfae890bc08004cd3888922a2 \ - --hash=sha256:de0b4caa1c8a21394e8ce971997614a17648f94e1cd0640fbd6b4d14cab13a72 \ - --hash=sha256:debb633f3f7856f95ad957d9b9c781f8e2c6303ef21724ec94bea2ce2fcbd056 \ - --hash=sha256:e372d7dfd154009142631de2d316adad3cc1c36c32a38b16a4751ba78da2a397 \ - --hash=sha256:ecd26be9f112c4f96718290c10f4caea6cc798459a3a76636b817a0ed7874e42 \ - --hash=sha256:edc0202099ea1d82844316604e17d2b175044f9bcb6b398aab781eba957224bd \ - --hash=sha256:f194cce575e59ffe442c10a360182a986535fd90b57f7debfaa5c845c409ecc3 \ - --hash=sha256:f5fb672c396d826ca16a022ac04c9dce74e00a1c344f6ad1a0fdc1ba1f332213 \ - --hash=sha256:f6a02a3c7950cafaadcd46a226ad9e12fc9744652cc69f9e5534f98b47f3bbcf \ - --hash=sha256:fe81b35c33772e56f4b6cf62cf4aedc1762ef7162a31e6ac7fe5e40d0149eb67 - # via requests -click==8.1.3 \ - --hash=sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e \ - --hash=sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48 - # via flask -docutils==0.20.1 \ - --hash=sha256:96f387a2c5562db4476f09f13bbab2192e764cac08ebbf3a34a95d9b1e4a59d6 \ - --hash=sha256:f08a4e276c3a1583a86dce3e34aba3fe04d02bba2dd51ed16106244e8a923e3b - # via sphinx -flask==2.2.2 \ - --hash=sha256:642c450d19c4ad482f96729bd2a8f6d32554aa1e231f4f6b4e7e5264b16cca2b \ - --hash=sha256:b9c46cc36662a7949f34b52d8ec7bb59c0d74ba08ba6cb9ce9adc1d8676d9526 - # via -r requirements.in -idna==3.4 \ - --hash=sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4 \ - --hash=sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2 - # via requests -imagesize==1.4.1 \ - --hash=sha256:0d8d18d08f840c19d0ee7ca1fd82490fdc3729b7ac93f49870406ddde8ef8d8b \ - --hash=sha256:69150444affb9cb0d5cc5a92b3676f0b2fb7cd9ae39e947a5e11a36b4497cd4a - # via sphinx -importlib-metadata==5.2.0 \ - --hash=sha256:0eafa39ba42bf225fc00e67f701d71f85aead9f878569caf13c3724f704b970f \ - --hash=sha256:404d48d62bba0b7a77ff9d405efd91501bef2e67ff4ace0bed40a0cf28c3c7cd - # via - # flask - # sphinx -itsdangerous==2.1.2 \ - --hash=sha256:2c2349112351b88699d8d4b6b075022c0808887cb7ad10069318a8b0bc88db44 \ - --hash=sha256:5dbbc68b317e5e42f327f9021763545dc3fc3bfe22e6deb96aaf1fc38874156a - # via flask -jinja2==3.1.2 \ - --hash=sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852 \ - --hash=sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61 - # via - # flask - # sphinx -markupsafe==2.1.1 \ - --hash=sha256:0212a68688482dc52b2d45013df70d169f542b7394fc744c02a57374a4207003 \ - --hash=sha256:089cf3dbf0cd6c100f02945abeb18484bd1ee57a079aefd52cffd17fba910b88 \ - --hash=sha256:10c1bfff05d95783da83491be968e8fe789263689c02724e0c691933c52994f5 \ - --hash=sha256:33b74d289bd2f5e527beadcaa3f401e0df0a89927c1559c8566c066fa4248ab7 \ - --hash=sha256:3799351e2336dc91ea70b034983ee71cf2f9533cdff7c14c90ea126bfd95d65a \ - --hash=sha256:3ce11ee3f23f79dbd06fb3d63e2f6af7b12db1d46932fe7bd8afa259a5996603 \ - --hash=sha256:421be9fbf0ffe9ffd7a378aafebbf6f4602d564d34be190fc19a193232fd12b1 \ - --hash=sha256:43093fb83d8343aac0b1baa75516da6092f58f41200907ef92448ecab8825135 \ - --hash=sha256:46d00d6cfecdde84d40e572d63735ef81423ad31184100411e6e3388d405e247 \ - --hash=sha256:4a33dea2b688b3190ee12bd7cfa29d39c9ed176bda40bfa11099a3ce5d3a7ac6 \ - --hash=sha256:4b9fe39a2ccc108a4accc2676e77da025ce383c108593d65cc909add5c3bd601 \ - --hash=sha256:56442863ed2b06d19c37f94d999035e15ee982988920e12a5b4ba29b62ad1f77 \ - --hash=sha256:671cd1187ed5e62818414afe79ed29da836dde67166a9fac6d435873c44fdd02 \ - --hash=sha256:694deca8d702d5db21ec83983ce0bb4b26a578e71fbdbd4fdcd387daa90e4d5e \ - --hash=sha256:6a074d34ee7a5ce3effbc526b7083ec9731bb3cbf921bbe1d3005d4d2bdb3a63 \ - --hash=sha256:6d0072fea50feec76a4c418096652f2c3238eaa014b2f94aeb1d56a66b41403f \ - --hash=sha256:6fbf47b5d3728c6aea2abb0589b5d30459e369baa772e0f37a0320185e87c980 \ - --hash=sha256:7f91197cc9e48f989d12e4e6fbc46495c446636dfc81b9ccf50bb0ec74b91d4b \ - --hash=sha256:86b1f75c4e7c2ac2ccdaec2b9022845dbb81880ca318bb7a0a01fbf7813e3812 \ - --hash=sha256:8dc1c72a69aa7e082593c4a203dcf94ddb74bb5c8a731e4e1eb68d031e8498ff \ - --hash=sha256:8e3dcf21f367459434c18e71b2a9532d96547aef8a871872a5bd69a715c15f96 \ - --hash=sha256:8e576a51ad59e4bfaac456023a78f6b5e6e7651dcd383bcc3e18d06f9b55d6d1 \ - --hash=sha256:96e37a3dc86e80bf81758c152fe66dbf60ed5eca3d26305edf01892257049925 \ - --hash=sha256:97a68e6ada378df82bc9f16b800ab77cbf4b2fada0081794318520138c088e4a \ - --hash=sha256:99a2a507ed3ac881b975a2976d59f38c19386d128e7a9a18b7df6fff1fd4c1d6 \ - --hash=sha256:a49907dd8420c5685cfa064a1335b6754b74541bbb3706c259c02ed65b644b3e \ - --hash=sha256:b09bf97215625a311f669476f44b8b318b075847b49316d3e28c08e41a7a573f \ - --hash=sha256:b7bd98b796e2b6553da7225aeb61f447f80a1ca64f41d83612e6139ca5213aa4 \ - --hash=sha256:b87db4360013327109564f0e591bd2a3b318547bcef31b468a92ee504d07ae4f \ - --hash=sha256:bcb3ed405ed3222f9904899563d6fc492ff75cce56cba05e32eff40e6acbeaa3 \ - --hash=sha256:d4306c36ca495956b6d568d276ac11fdd9c30a36f1b6eb928070dc5360b22e1c \ - --hash=sha256:d5ee4f386140395a2c818d149221149c54849dfcfcb9f1debfe07a8b8bd63f9a \ - --hash=sha256:dda30ba7e87fbbb7eab1ec9f58678558fd9a6b8b853530e176eabd064da81417 \ - --hash=sha256:e04e26803c9c3851c931eac40c695602c6295b8d432cbe78609649ad9bd2da8a \ - --hash=sha256:e1c0b87e09fa55a220f058d1d49d3fb8df88fbfab58558f1198e08c1e1de842a \ - --hash=sha256:e72591e9ecd94d7feb70c1cbd7be7b3ebea3f548870aa91e2732960fa4d57a37 \ - --hash=sha256:e8c843bbcda3a2f1e3c2ab25913c80a3c5376cd00c6e8c4a86a89a28c8dc5452 \ - --hash=sha256:efc1913fd2ca4f334418481c7e595c00aad186563bbc1ec76067848c7ca0a933 \ - --hash=sha256:f121a1420d4e173a5d96e47e9a0c0dcff965afdf1626d28de1460815f7c4ee7a \ - --hash=sha256:fc7b548b17d238737688817ab67deebb30e8073c95749d55538ed473130ec0c7 - # via - # jinja2 - # werkzeug -packaging==23.2 \ - --hash=sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5 \ - --hash=sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7 - # via sphinx -pygments==2.16.1 \ - --hash=sha256:13fc09fa63bc8d8671a6d247e1eb303c4b343eaee81d861f3404db2935653692 \ - --hash=sha256:1daff0494820c69bc8941e407aa20f577374ee88364ee10a98fdbe0aece96e29 - # via sphinx -requests==2.31.0 \ - --hash=sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f \ - --hash=sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1 - # via sphinx -snowballstemmer==2.2.0 \ - --hash=sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1 \ - --hash=sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a - # via sphinx -sphinx==7.2.6 \ - --hash=sha256:1e09160a40b956dc623c910118fa636da93bd3ca0b9876a7b3df90f07d691560 \ - --hash=sha256:9a5160e1ea90688d5963ba09a2dcd8bdd526620edbb65c328728f1b2228d5ab5 - # via - # -r requirements.in - # sphinxcontrib-applehelp - # sphinxcontrib-devhelp - # sphinxcontrib-htmlhelp - # sphinxcontrib-qthelp - # sphinxcontrib-serializinghtml -sphinxcontrib-applehelp==1.0.7 \ - --hash=sha256:094c4d56209d1734e7d252f6e0b3ccc090bd52ee56807a5d9315b19c122ab15d \ - --hash=sha256:39fdc8d762d33b01a7d8f026a3b7d71563ea3b72787d5f00ad8465bd9d6dfbfa - # via sphinx -sphinxcontrib-devhelp==1.0.5 \ - --hash=sha256:63b41e0d38207ca40ebbeabcf4d8e51f76c03e78cd61abe118cf4435c73d4212 \ - --hash=sha256:fe8009aed765188f08fcaadbb3ea0d90ce8ae2d76710b7e29ea7d047177dae2f - # via sphinx -sphinxcontrib-htmlhelp==2.0.4 \ - --hash=sha256:6c26a118a05b76000738429b724a0568dbde5b72391a688577da08f11891092a \ - --hash=sha256:8001661c077a73c29beaf4a79968d0726103c5605e27db92b9ebed8bab1359e9 - # via sphinx -sphinxcontrib-jsmath==1.0.1 \ - --hash=sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178 \ - --hash=sha256:a9925e4a4587247ed2191a22df5f6970656cb8ca2bd6284309578f2153e0c4b8 - # via sphinx -sphinxcontrib-qthelp==1.0.6 \ - --hash=sha256:62b9d1a186ab7f5ee3356d906f648cacb7a6bdb94d201ee7adf26db55092982d \ - --hash=sha256:bf76886ee7470b934e363da7a954ea2825650013d367728588732c7350f49ea4 - # via sphinx -sphinxcontrib-serializinghtml==1.1.9 \ - --hash=sha256:0c64ff898339e1fac29abd2bf5f11078f3ec413cfe9c046d3120d7ca65530b54 \ - --hash=sha256:9b36e503703ff04f20e9675771df105e58aa029cfcbc23b8ed716019b7416ae1 - # via - # -r requirements.in - # sphinx -urllib3==2.0.7 \ - --hash=sha256:c97dfde1f7bd43a71c8d2a58e369e9b2bf692d1334ea9f9cae55add7d0dd0f84 \ - --hash=sha256:fdb6d215c776278489906c2f8916e6e7d4f5a9b602ccbcfdf7f016fc8da0596e - # via requests -werkzeug==2.2.2 \ - --hash=sha256:7ea2d48322cc7c0f8b3a215ed73eabd7b5d75d0b50e31ab006286ccff9e00b8f \ - --hash=sha256:f979ab81f58d7318e064e99c4506445d60135ac5cd2e177a2de0089bfd4c9bd5 - # via flask -zipp==3.11.0 \ - --hash=sha256:83a28fcb75844b5c0cdaf5aa4003c2d728c77e05f5aeabe8e95e56727005fbaa \ - --hash=sha256:a7a22e05929290a67401440b39690ae6563279bced5f314609d9d03798f56766 - # via importlib-metadata diff --git a/examples/build_file_generation/requirements_windows.txt b/examples/build_file_generation/requirements_windows.txt deleted file mode 100644 index 19709690ea..0000000000 --- a/examples/build_file_generation/requirements_windows.txt +++ /dev/null @@ -1,260 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.9 -# by the following command: -# -# bazel run //:requirements.update -# -alabaster==0.7.13 \ - --hash=sha256:1ee19aca801bbabb5ba3f5f258e4422dfa86f82f3e9cefb0859b283cdd7f62a3 \ - --hash=sha256:a27a4a084d5e690e16e01e03ad2b2e552c61a65469419b907243193de1a84ae2 - # via sphinx -babel==2.13.1 \ - --hash=sha256:33e0952d7dd6374af8dbf6768cc4ddf3ccfefc244f9986d4074704f2fbd18900 \ - --hash=sha256:7077a4984b02b6727ac10f1f7294484f737443d7e2e66c5e4380e41a3ae0b4ed - # via sphinx -certifi==2023.7.22 \ - --hash=sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082 \ - --hash=sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9 - # via requests -charset-normalizer==3.3.1 \ - --hash=sha256:06cf46bdff72f58645434d467bf5228080801298fbba19fe268a01b4534467f5 \ - --hash=sha256:0c8c61fb505c7dad1d251c284e712d4e0372cef3b067f7ddf82a7fa82e1e9a93 \ - --hash=sha256:10b8dd31e10f32410751b3430996f9807fc4d1587ca69772e2aa940a82ab571a \ - --hash=sha256:1171ef1fc5ab4693c5d151ae0fdad7f7349920eabbaca6271f95969fa0756c2d \ - --hash=sha256:17a866d61259c7de1bdadef418a37755050ddb4b922df8b356503234fff7932c \ - --hash=sha256:1d6bfc32a68bc0933819cfdfe45f9abc3cae3877e1d90aac7259d57e6e0f85b1 \ - --hash=sha256:1ec937546cad86d0dce5396748bf392bb7b62a9eeb8c66efac60e947697f0e58 \ - --hash=sha256:223b4d54561c01048f657fa6ce41461d5ad8ff128b9678cfe8b2ecd951e3f8a2 \ - --hash=sha256:2465aa50c9299d615d757c1c888bc6fef384b7c4aec81c05a0172b4400f98557 \ - --hash=sha256:28f512b9a33235545fbbdac6a330a510b63be278a50071a336afc1b78781b147 \ - --hash=sha256:2c092be3885a1b7899cd85ce24acedc1034199d6fca1483fa2c3a35c86e43041 \ - --hash=sha256:2c4c99f98fc3a1835af8179dcc9013f93594d0670e2fa80c83aa36346ee763d2 \ - --hash=sha256:31445f38053476a0c4e6d12b047b08ced81e2c7c712e5a1ad97bc913256f91b2 \ - --hash=sha256:31bbaba7218904d2eabecf4feec0d07469284e952a27400f23b6628439439fa7 \ - --hash=sha256:34d95638ff3613849f473afc33f65c401a89f3b9528d0d213c7037c398a51296 \ - --hash=sha256:352a88c3df0d1fa886562384b86f9a9e27563d4704ee0e9d56ec6fcd270ea690 \ - --hash=sha256:39b70a6f88eebe239fa775190796d55a33cfb6d36b9ffdd37843f7c4c1b5dc67 \ - --hash=sha256:3c66df3f41abee950d6638adc7eac4730a306b022570f71dd0bd6ba53503ab57 \ - --hash=sha256:3f70fd716855cd3b855316b226a1ac8bdb3caf4f7ea96edcccc6f484217c9597 \ - --hash=sha256:3f9bc2ce123637a60ebe819f9fccc614da1bcc05798bbbaf2dd4ec91f3e08846 \ - --hash=sha256:3fb765362688821404ad6cf86772fc54993ec11577cd5a92ac44b4c2ba52155b \ - --hash=sha256:45f053a0ece92c734d874861ffe6e3cc92150e32136dd59ab1fb070575189c97 \ - --hash=sha256:46fb9970aa5eeca547d7aa0de5d4b124a288b42eaefac677bde805013c95725c \ - --hash=sha256:4cb50a0335382aac15c31b61d8531bc9bb657cfd848b1d7158009472189f3d62 \ - --hash=sha256:4e12f8ee80aa35e746230a2af83e81bd6b52daa92a8afaef4fea4a2ce9b9f4fa \ - --hash=sha256:4f3100d86dcd03c03f7e9c3fdb23d92e32abbca07e7c13ebd7ddfbcb06f5991f \ - --hash=sha256:4f6e2a839f83a6a76854d12dbebde50e4b1afa63e27761549d006fa53e9aa80e \ - --hash=sha256:4f861d94c2a450b974b86093c6c027888627b8082f1299dfd5a4bae8e2292821 \ - --hash=sha256:501adc5eb6cd5f40a6f77fbd90e5ab915c8fd6e8c614af2db5561e16c600d6f3 \ - --hash=sha256:520b7a142d2524f999447b3a0cf95115df81c4f33003c51a6ab637cbda9d0bf4 \ - --hash=sha256:548eefad783ed787b38cb6f9a574bd8664468cc76d1538215d510a3cd41406cb \ - --hash=sha256:555fe186da0068d3354cdf4bbcbc609b0ecae4d04c921cc13e209eece7720727 \ - --hash=sha256:55602981b2dbf8184c098bc10287e8c245e351cd4fdcad050bd7199d5a8bf514 \ - --hash=sha256:58e875eb7016fd014c0eea46c6fa92b87b62c0cb31b9feae25cbbe62c919f54d \ - --hash=sha256:5a3580a4fdc4ac05f9e53c57f965e3594b2f99796231380adb2baaab96e22761 \ - --hash=sha256:5b70bab78accbc672f50e878a5b73ca692f45f5b5e25c8066d748c09405e6a55 \ - --hash=sha256:5ceca5876032362ae73b83347be8b5dbd2d1faf3358deb38c9c88776779b2e2f \ - --hash=sha256:61f1e3fb621f5420523abb71f5771a204b33c21d31e7d9d86881b2cffe92c47c \ - --hash=sha256:633968254f8d421e70f91c6ebe71ed0ab140220469cf87a9857e21c16687c034 \ - --hash=sha256:63a6f59e2d01310f754c270e4a257426fe5a591dc487f1983b3bbe793cf6bac6 \ - --hash=sha256:63accd11149c0f9a99e3bc095bbdb5a464862d77a7e309ad5938fbc8721235ae \ - --hash=sha256:6db3cfb9b4fcecb4390db154e75b49578c87a3b9979b40cdf90d7e4b945656e1 \ - --hash=sha256:71ef3b9be10070360f289aea4838c784f8b851be3ba58cf796262b57775c2f14 \ - --hash=sha256:7ae8e5142dcc7a49168f4055255dbcced01dc1714a90a21f87448dc8d90617d1 \ - --hash=sha256:7b6cefa579e1237ce198619b76eaa148b71894fb0d6bcf9024460f9bf30fd228 \ - --hash=sha256:800561453acdecedaac137bf09cd719c7a440b6800ec182f077bb8e7025fb708 \ - --hash=sha256:82ca51ff0fc5b641a2d4e1cc8c5ff108699b7a56d7f3ad6f6da9dbb6f0145b48 \ - --hash=sha256:851cf693fb3aaef71031237cd68699dded198657ec1e76a76eb8be58c03a5d1f \ - --hash=sha256:854cc74367180beb327ab9d00f964f6d91da06450b0855cbbb09187bcdb02de5 \ - --hash=sha256:87071618d3d8ec8b186d53cb6e66955ef2a0e4fa63ccd3709c0c90ac5a43520f \ - --hash=sha256:871d045d6ccc181fd863a3cd66ee8e395523ebfbc57f85f91f035f50cee8e3d4 \ - --hash=sha256:8aee051c89e13565c6bd366813c386939f8e928af93c29fda4af86d25b73d8f8 \ - --hash=sha256:8af5a8917b8af42295e86b64903156b4f110a30dca5f3b5aedea123fbd638bff \ - --hash=sha256:8ec8ef42c6cd5856a7613dcd1eaf21e5573b2185263d87d27c8edcae33b62a61 \ - --hash=sha256:91e43805ccafa0a91831f9cd5443aa34528c0c3f2cc48c4cb3d9a7721053874b \ - --hash=sha256:9505dc359edb6a330efcd2be825fdb73ee3e628d9010597aa1aee5aa63442e97 \ - --hash=sha256:985c7965f62f6f32bf432e2681173db41336a9c2611693247069288bcb0c7f8b \ - --hash=sha256:9a74041ba0bfa9bc9b9bb2cd3238a6ab3b7618e759b41bd15b5f6ad958d17605 \ - --hash=sha256:9edbe6a5bf8b56a4a84533ba2b2f489d0046e755c29616ef8830f9e7d9cf5728 \ - --hash=sha256:a15c1fe6d26e83fd2e5972425a772cca158eae58b05d4a25a4e474c221053e2d \ - --hash=sha256:a66bcdf19c1a523e41b8e9d53d0cedbfbac2e93c649a2e9502cb26c014d0980c \ - --hash=sha256:ae4070f741f8d809075ef697877fd350ecf0b7c5837ed68738607ee0a2c572cf \ - --hash=sha256:ae55d592b02c4349525b6ed8f74c692509e5adffa842e582c0f861751701a673 \ - --hash=sha256:b578cbe580e3b41ad17b1c428f382c814b32a6ce90f2d8e39e2e635d49e498d1 \ - --hash=sha256:b891a2f68e09c5ef989007fac11476ed33c5c9994449a4e2c3386529d703dc8b \ - --hash=sha256:baec8148d6b8bd5cee1ae138ba658c71f5b03e0d69d5907703e3e1df96db5e41 \ - --hash=sha256:bb06098d019766ca16fc915ecaa455c1f1cd594204e7f840cd6258237b5079a8 \ - --hash=sha256:bc791ec3fd0c4309a753f95bb6c749ef0d8ea3aea91f07ee1cf06b7b02118f2f \ - --hash=sha256:bd28b31730f0e982ace8663d108e01199098432a30a4c410d06fe08fdb9e93f4 \ - --hash=sha256:be4d9c2770044a59715eb57c1144dedea7c5d5ae80c68fb9959515037cde2008 \ - --hash=sha256:c0c72d34e7de5604df0fde3644cc079feee5e55464967d10b24b1de268deceb9 \ - --hash=sha256:c0e842112fe3f1a4ffcf64b06dc4c61a88441c2f02f373367f7b4c1aa9be2ad5 \ - --hash=sha256:c15070ebf11b8b7fd1bfff7217e9324963c82dbdf6182ff7050519e350e7ad9f \ - --hash=sha256:c2000c54c395d9e5e44c99dc7c20a64dc371f777faf8bae4919ad3e99ce5253e \ - --hash=sha256:c30187840d36d0ba2893bc3271a36a517a717f9fd383a98e2697ee890a37c273 \ - --hash=sha256:cb7cd68814308aade9d0c93c5bd2ade9f9441666f8ba5aa9c2d4b389cb5e2a45 \ - --hash=sha256:cd805513198304026bd379d1d516afbf6c3c13f4382134a2c526b8b854da1c2e \ - --hash=sha256:d0bf89afcbcf4d1bb2652f6580e5e55a840fdf87384f6063c4a4f0c95e378656 \ - --hash=sha256:d9137a876020661972ca6eec0766d81aef8a5627df628b664b234b73396e727e \ - --hash=sha256:dbd95e300367aa0827496fe75a1766d198d34385a58f97683fe6e07f89ca3e3c \ - --hash=sha256:dced27917823df984fe0c80a5c4ad75cf58df0fbfae890bc08004cd3888922a2 \ - --hash=sha256:de0b4caa1c8a21394e8ce971997614a17648f94e1cd0640fbd6b4d14cab13a72 \ - --hash=sha256:debb633f3f7856f95ad957d9b9c781f8e2c6303ef21724ec94bea2ce2fcbd056 \ - --hash=sha256:e372d7dfd154009142631de2d316adad3cc1c36c32a38b16a4751ba78da2a397 \ - --hash=sha256:ecd26be9f112c4f96718290c10f4caea6cc798459a3a76636b817a0ed7874e42 \ - --hash=sha256:edc0202099ea1d82844316604e17d2b175044f9bcb6b398aab781eba957224bd \ - --hash=sha256:f194cce575e59ffe442c10a360182a986535fd90b57f7debfaa5c845c409ecc3 \ - --hash=sha256:f5fb672c396d826ca16a022ac04c9dce74e00a1c344f6ad1a0fdc1ba1f332213 \ - --hash=sha256:f6a02a3c7950cafaadcd46a226ad9e12fc9744652cc69f9e5534f98b47f3bbcf \ - --hash=sha256:fe81b35c33772e56f4b6cf62cf4aedc1762ef7162a31e6ac7fe5e40d0149eb67 - # via requests -click==8.1.3 \ - --hash=sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e \ - --hash=sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48 - # via flask -colorama==0.4.6 \ - --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ - --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 - # via - # click - # sphinx -docutils==0.20.1 \ - --hash=sha256:96f387a2c5562db4476f09f13bbab2192e764cac08ebbf3a34a95d9b1e4a59d6 \ - --hash=sha256:f08a4e276c3a1583a86dce3e34aba3fe04d02bba2dd51ed16106244e8a923e3b - # via sphinx -flask==2.2.2 \ - --hash=sha256:642c450d19c4ad482f96729bd2a8f6d32554aa1e231f4f6b4e7e5264b16cca2b \ - --hash=sha256:b9c46cc36662a7949f34b52d8ec7bb59c0d74ba08ba6cb9ce9adc1d8676d9526 - # via -r requirements.in -idna==3.4 \ - --hash=sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4 \ - --hash=sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2 - # via requests -imagesize==1.4.1 \ - --hash=sha256:0d8d18d08f840c19d0ee7ca1fd82490fdc3729b7ac93f49870406ddde8ef8d8b \ - --hash=sha256:69150444affb9cb0d5cc5a92b3676f0b2fb7cd9ae39e947a5e11a36b4497cd4a - # via sphinx -importlib-metadata==5.2.0 \ - --hash=sha256:0eafa39ba42bf225fc00e67f701d71f85aead9f878569caf13c3724f704b970f \ - --hash=sha256:404d48d62bba0b7a77ff9d405efd91501bef2e67ff4ace0bed40a0cf28c3c7cd - # via - # flask - # sphinx -itsdangerous==2.1.2 \ - --hash=sha256:2c2349112351b88699d8d4b6b075022c0808887cb7ad10069318a8b0bc88db44 \ - --hash=sha256:5dbbc68b317e5e42f327f9021763545dc3fc3bfe22e6deb96aaf1fc38874156a - # via flask -jinja2==3.1.2 \ - --hash=sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852 \ - --hash=sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61 - # via - # flask - # sphinx -markupsafe==2.1.1 \ - --hash=sha256:0212a68688482dc52b2d45013df70d169f542b7394fc744c02a57374a4207003 \ - --hash=sha256:089cf3dbf0cd6c100f02945abeb18484bd1ee57a079aefd52cffd17fba910b88 \ - --hash=sha256:10c1bfff05d95783da83491be968e8fe789263689c02724e0c691933c52994f5 \ - --hash=sha256:33b74d289bd2f5e527beadcaa3f401e0df0a89927c1559c8566c066fa4248ab7 \ - --hash=sha256:3799351e2336dc91ea70b034983ee71cf2f9533cdff7c14c90ea126bfd95d65a \ - --hash=sha256:3ce11ee3f23f79dbd06fb3d63e2f6af7b12db1d46932fe7bd8afa259a5996603 \ - --hash=sha256:421be9fbf0ffe9ffd7a378aafebbf6f4602d564d34be190fc19a193232fd12b1 \ - --hash=sha256:43093fb83d8343aac0b1baa75516da6092f58f41200907ef92448ecab8825135 \ - --hash=sha256:46d00d6cfecdde84d40e572d63735ef81423ad31184100411e6e3388d405e247 \ - --hash=sha256:4a33dea2b688b3190ee12bd7cfa29d39c9ed176bda40bfa11099a3ce5d3a7ac6 \ - --hash=sha256:4b9fe39a2ccc108a4accc2676e77da025ce383c108593d65cc909add5c3bd601 \ - --hash=sha256:56442863ed2b06d19c37f94d999035e15ee982988920e12a5b4ba29b62ad1f77 \ - --hash=sha256:671cd1187ed5e62818414afe79ed29da836dde67166a9fac6d435873c44fdd02 \ - --hash=sha256:694deca8d702d5db21ec83983ce0bb4b26a578e71fbdbd4fdcd387daa90e4d5e \ - --hash=sha256:6a074d34ee7a5ce3effbc526b7083ec9731bb3cbf921bbe1d3005d4d2bdb3a63 \ - --hash=sha256:6d0072fea50feec76a4c418096652f2c3238eaa014b2f94aeb1d56a66b41403f \ - --hash=sha256:6fbf47b5d3728c6aea2abb0589b5d30459e369baa772e0f37a0320185e87c980 \ - --hash=sha256:7f91197cc9e48f989d12e4e6fbc46495c446636dfc81b9ccf50bb0ec74b91d4b \ - --hash=sha256:86b1f75c4e7c2ac2ccdaec2b9022845dbb81880ca318bb7a0a01fbf7813e3812 \ - --hash=sha256:8dc1c72a69aa7e082593c4a203dcf94ddb74bb5c8a731e4e1eb68d031e8498ff \ - --hash=sha256:8e3dcf21f367459434c18e71b2a9532d96547aef8a871872a5bd69a715c15f96 \ - --hash=sha256:8e576a51ad59e4bfaac456023a78f6b5e6e7651dcd383bcc3e18d06f9b55d6d1 \ - --hash=sha256:96e37a3dc86e80bf81758c152fe66dbf60ed5eca3d26305edf01892257049925 \ - --hash=sha256:97a68e6ada378df82bc9f16b800ab77cbf4b2fada0081794318520138c088e4a \ - --hash=sha256:99a2a507ed3ac881b975a2976d59f38c19386d128e7a9a18b7df6fff1fd4c1d6 \ - --hash=sha256:a49907dd8420c5685cfa064a1335b6754b74541bbb3706c259c02ed65b644b3e \ - --hash=sha256:b09bf97215625a311f669476f44b8b318b075847b49316d3e28c08e41a7a573f \ - --hash=sha256:b7bd98b796e2b6553da7225aeb61f447f80a1ca64f41d83612e6139ca5213aa4 \ - --hash=sha256:b87db4360013327109564f0e591bd2a3b318547bcef31b468a92ee504d07ae4f \ - --hash=sha256:bcb3ed405ed3222f9904899563d6fc492ff75cce56cba05e32eff40e6acbeaa3 \ - --hash=sha256:d4306c36ca495956b6d568d276ac11fdd9c30a36f1b6eb928070dc5360b22e1c \ - --hash=sha256:d5ee4f386140395a2c818d149221149c54849dfcfcb9f1debfe07a8b8bd63f9a \ - --hash=sha256:dda30ba7e87fbbb7eab1ec9f58678558fd9a6b8b853530e176eabd064da81417 \ - --hash=sha256:e04e26803c9c3851c931eac40c695602c6295b8d432cbe78609649ad9bd2da8a \ - --hash=sha256:e1c0b87e09fa55a220f058d1d49d3fb8df88fbfab58558f1198e08c1e1de842a \ - --hash=sha256:e72591e9ecd94d7feb70c1cbd7be7b3ebea3f548870aa91e2732960fa4d57a37 \ - --hash=sha256:e8c843bbcda3a2f1e3c2ab25913c80a3c5376cd00c6e8c4a86a89a28c8dc5452 \ - --hash=sha256:efc1913fd2ca4f334418481c7e595c00aad186563bbc1ec76067848c7ca0a933 \ - --hash=sha256:f121a1420d4e173a5d96e47e9a0c0dcff965afdf1626d28de1460815f7c4ee7a \ - --hash=sha256:fc7b548b17d238737688817ab67deebb30e8073c95749d55538ed473130ec0c7 - # via - # jinja2 - # werkzeug -packaging==23.2 \ - --hash=sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5 \ - --hash=sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7 - # via sphinx -pygments==2.16.1 \ - --hash=sha256:13fc09fa63bc8d8671a6d247e1eb303c4b343eaee81d861f3404db2935653692 \ - --hash=sha256:1daff0494820c69bc8941e407aa20f577374ee88364ee10a98fdbe0aece96e29 - # via sphinx -requests==2.31.0 \ - --hash=sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f \ - --hash=sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1 - # via sphinx -snowballstemmer==2.2.0 \ - --hash=sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1 \ - --hash=sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a - # via sphinx -sphinx==7.2.6 \ - --hash=sha256:1e09160a40b956dc623c910118fa636da93bd3ca0b9876a7b3df90f07d691560 \ - --hash=sha256:9a5160e1ea90688d5963ba09a2dcd8bdd526620edbb65c328728f1b2228d5ab5 - # via - # -r requirements.in - # sphinxcontrib-applehelp - # sphinxcontrib-devhelp - # sphinxcontrib-htmlhelp - # sphinxcontrib-qthelp - # sphinxcontrib-serializinghtml -sphinxcontrib-applehelp==1.0.7 \ - --hash=sha256:094c4d56209d1734e7d252f6e0b3ccc090bd52ee56807a5d9315b19c122ab15d \ - --hash=sha256:39fdc8d762d33b01a7d8f026a3b7d71563ea3b72787d5f00ad8465bd9d6dfbfa - # via sphinx -sphinxcontrib-devhelp==1.0.5 \ - --hash=sha256:63b41e0d38207ca40ebbeabcf4d8e51f76c03e78cd61abe118cf4435c73d4212 \ - --hash=sha256:fe8009aed765188f08fcaadbb3ea0d90ce8ae2d76710b7e29ea7d047177dae2f - # via sphinx -sphinxcontrib-htmlhelp==2.0.4 \ - --hash=sha256:6c26a118a05b76000738429b724a0568dbde5b72391a688577da08f11891092a \ - --hash=sha256:8001661c077a73c29beaf4a79968d0726103c5605e27db92b9ebed8bab1359e9 - # via sphinx -sphinxcontrib-jsmath==1.0.1 \ - --hash=sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178 \ - --hash=sha256:a9925e4a4587247ed2191a22df5f6970656cb8ca2bd6284309578f2153e0c4b8 - # via sphinx -sphinxcontrib-qthelp==1.0.6 \ - --hash=sha256:62b9d1a186ab7f5ee3356d906f648cacb7a6bdb94d201ee7adf26db55092982d \ - --hash=sha256:bf76886ee7470b934e363da7a954ea2825650013d367728588732c7350f49ea4 - # via sphinx -sphinxcontrib-serializinghtml==1.1.9 \ - --hash=sha256:0c64ff898339e1fac29abd2bf5f11078f3ec413cfe9c046d3120d7ca65530b54 \ - --hash=sha256:9b36e503703ff04f20e9675771df105e58aa029cfcbc23b8ed716019b7416ae1 - # via - # -r requirements.in - # sphinx -urllib3==2.0.7 \ - --hash=sha256:c97dfde1f7bd43a71c8d2a58e369e9b2bf692d1334ea9f9cae55add7d0dd0f84 \ - --hash=sha256:fdb6d215c776278489906c2f8916e6e7d4f5a9b602ccbcfdf7f016fc8da0596e - # via requests -werkzeug==2.2.2 \ - --hash=sha256:7ea2d48322cc7c0f8b3a215ed73eabd7b5d75d0b50e31ab006286ccff9e00b8f \ - --hash=sha256:f979ab81f58d7318e064e99c4506445d60135ac5cd2e177a2de0089bfd4c9bd5 - # via flask -zipp==3.11.0 \ - --hash=sha256:83a28fcb75844b5c0cdaf5aa4003c2d728c77e05f5aeabe8e95e56727005fbaa \ - --hash=sha256:a7a22e05929290a67401440b39690ae6563279bced5f314609d9d03798f56766 - # via importlib-metadata diff --git a/examples/multi_python_versions/WORKSPACE b/examples/multi_python_versions/WORKSPACE index 0b6b8a0cbf..e69de29bb2 100644 --- a/examples/multi_python_versions/WORKSPACE +++ b/examples/multi_python_versions/WORKSPACE @@ -1,66 +0,0 @@ -workspace(name = "rules_python_multi_python_versions") - -local_repository( - name = "rules_python", - path = "../..", -) - -load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_multi_toolchains") - -py_repositories() - -default_python_version = "3.10" - -python_register_multi_toolchains( - name = "python", - default_version = default_python_version, - python_versions = [ - "3.10", - "3.11", - "3.12", - "3.13", - "3.14", - ], - register_coverage_tool = True, -) - -load("@python//:pip.bzl", "multi_pip_parse") - -multi_pip_parse( - name = "pypi", - default_version = default_python_version, - python_interpreter_target = { - "3.10": "@python_3_10_host//:python", - "3.11": "@python_3_11_host//:python", - "3.12": "@python_3_12_host//:python", - "3.13": "@python_3_13_host//:python", - "3.14": "@python_3_14_host//:python", - }, - requirements_lock = { - "3.10": "//requirements:requirements_lock_3_10.txt", - "3.11": "//requirements:requirements_lock_3_11.txt", - "3.12": "//requirements:requirements_lock_3_12.txt", - "3.13": "//requirements:requirements_lock_3_13.txt", - "3.14": "//requirements:requirements_lock_3_14.txt", - }, -) - -load("@pypi//:requirements.bzl", "install_deps") - -install_deps() - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -# See https://github.com/bazelbuild/rules_shell/releases/tag/v0.2.0 -http_archive( - name = "rules_shell", - sha256 = "410e8ff32e018b9efd2743507e7595c26e2628567c42224411ff533b57d27c28", - strip_prefix = "rules_shell-0.2.0", - url = "https://github.com/bazelbuild/rules_shell/releases/download/v0.2.0/rules_shell-v0.2.0.tar.gz", -) - -load("@rules_shell//shell:repositories.bzl", "rules_shell_dependencies", "rules_shell_toolchains") - -rules_shell_dependencies() - -rules_shell_toolchains() diff --git a/examples/multi_python_versions/WORKSPACE.bzlmod b/examples/multi_python_versions/WORKSPACE.bzlmod deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/examples/pip_parse/WORKSPACE b/examples/pip_parse/WORKSPACE index e0d60af9ff..e69de29bb2 100644 --- a/examples/pip_parse/WORKSPACE +++ b/examples/pip_parse/WORKSPACE @@ -1,65 +0,0 @@ -workspace(name = "rules_python_pip_parse_example") - -local_repository( - name = "rules_python", - path = "../..", -) - -load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains") - -py_repositories() - -python_register_toolchains( - name = "python_3_9", - python_version = "3.9.25", -) - -load("@rules_python//python:pip.bzl", "pip_parse") - -pip_parse( - # (Optional) You can set an environment in the pip process to control its - # behavior. Note that pip is run in "isolated" mode so no PIP__ - # style env vars are read, but env vars that control requests and urllib3 - # can be passed - # environment = {"HTTPS_PROXY": "http://my.proxy.fun/"}, - name = "pypi", - - # Requirement groups allow Bazel to tolerate PyPi cycles by putting dependencies - # which are known to form cycles into groups together. - experimental_requirement_cycles = { - "sphinx": [ - "sphinx", - "sphinxcontrib-qthelp", - "sphinxcontrib-htmlhelp", - "sphinxcontrib-devhelp", - "sphinxcontrib-applehelp", - "sphinxcontrib-serializinghtml", - ], - }, - # (Optional) You can provide extra parameters to pip. - # Here, make pip output verbose (this is usable with `quiet = False`). - # extra_pip_args = ["-v"], - - # (Optional) You can exclude custom elements in the data section of the generated BUILD files for pip packages. - # Exclude directories with spaces in their names in this example (avoids build errors if there are such directories). - #pip_data_exclude = ["**/* */**"], - - # (Optional) You can provide a python_interpreter (path) or a python_interpreter_target (a Bazel target, that - # acts as an executable). The latter can be anything that could be used as Python interpreter. E.g.: - # 1. Python interpreter that you compile in the build file (as above in @python_interpreter). - # 2. Pre-compiled python interpreter included with http_archive - # 3. Wrapper script, like in the autodetecting python toolchain. - # - # Here, we use the interpreter constant that resolves to the host interpreter from the default Python toolchain. - python_interpreter_target = "@python_3_9_host//:python", - - # (Optional) You can set quiet to False if you want to see pip output. - #quiet = False, - requirements_lock = "//:requirements_lock.txt", - requirements_windows = "//:requirements_windows.txt", -) - -load("@pypi//:requirements.bzl", "install_deps") - -# Initialize repositories for all packages in requirements_lock.txt. -install_deps() diff --git a/examples/pip_parse/WORKSPACE.bzlmod b/examples/pip_parse/WORKSPACE.bzlmod deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/examples/pip_parse_vendored/.bazelrc b/examples/pip_parse_vendored/.bazelrc deleted file mode 100644 index a6ea2d9138..0000000000 --- a/examples/pip_parse_vendored/.bazelrc +++ /dev/null @@ -1,10 +0,0 @@ -test --test_output=errors - -# Windows requires these for multi-python support: -build --enable_runfiles - -# Vendoring requirements.bzl files isn't necessary under bzlmod -# When workspace support is dropped, this example can be removed. -common --noenable_bzlmod -common --enable_workspace -common --incompatible_python_disallow_native_rules diff --git a/examples/pip_parse_vendored/.bazelversion b/examples/pip_parse_vendored/.bazelversion deleted file mode 100644 index 35907cd9ca..0000000000 --- a/examples/pip_parse_vendored/.bazelversion +++ /dev/null @@ -1 +0,0 @@ -7.x diff --git a/examples/pip_parse_vendored/.gitignore b/examples/pip_parse_vendored/.gitignore deleted file mode 100644 index ac51a054d2..0000000000 --- a/examples/pip_parse_vendored/.gitignore +++ /dev/null @@ -1 +0,0 @@ -bazel-* diff --git a/examples/pip_parse_vendored/BUILD.bazel b/examples/pip_parse_vendored/BUILD.bazel deleted file mode 100644 index 74b9286359..0000000000 --- a/examples/pip_parse_vendored/BUILD.bazel +++ /dev/null @@ -1,77 +0,0 @@ -load("@bazel_skylib//rules:build_test.bzl", "build_test") -load("@bazel_skylib//rules:diff_test.bzl", "diff_test") -load("@bazel_skylib//rules:write_file.bzl", "write_file") -load("@rules_python//python:pip.bzl", "compile_pip_requirements") -load("@rules_python//python:py_test.bzl", "py_test") -load("@rules_shell//shell:sh_binary.bzl", "sh_binary") -load("//:requirements.bzl", "all_data_requirements", "all_requirements", "all_whl_requirements", "requirement") - -# This rule adds a convenient way to update the requirements.txt -# lockfile based on the requirements.in. -compile_pip_requirements( - name = "requirements", - src = "requirements.in", -) - -# The requirements.bzl file is using the hub repo to access packages via the -# `requirement` macro and when the requirements.bzl is vendored, the hub -# repo won't be present. As a result, we have to adjust the label scheme in -# the requirements.bzl to make sure that they continue to work. -genrule( - name = "requirement_bzl", - srcs = ["@pip_deps_to_be_vendored//:requirements.bzl"], - outs = ["requirements.clean.bzl"], - cmd = " | ".join([ - "cat $<", - # Substitute the name of the hub to ensure that the dependencies do - # not require the hub repo initialized in the WORKSPACE. - "sed -e 's/pip_deps_to_be_vendored/my_project_pip_deps_vendored/g'", - # Change the labels from using the hub repo to using the spoke repos - # directly. - "sed -e 's|//\\([^:]*\\):pkg|_\\1//:pkg|g'", - "sed -e 's|//\\([^:]*\\):whl|_\\1//:whl|g'", - "sed -e 's|//\\([^:]*\\):data|_\\1//:data|g'", - # Change the convenience macros to use the same naming. - "sed -e 's|//{}:{}|_{}//:{}|g' >$@", - ]), -) - -write_file( - name = "gen_update", - out = "update.sh", - content = [ - # This depends on bash, would need tweaks for Windows - "#!/usr/bin/env bash", - # Bazel gives us a way to access the source folder! - "cd $BUILD_WORKSPACE_DIRECTORY", - "cp -fv bazel-bin/requirements.clean.bzl requirements.bzl", - ], -) - -sh_binary( - name = "vendor_requirements", - srcs = ["update.sh"], - data = [":requirement_bzl"], -) - -# Similarly ensures that the requirements.bzl file is updated -# based on the requirements.txt lockfile. -diff_test( - name = "test_vendored", - failure_message = "Please run: bazel run //:vendor_requirements", - file1 = "requirements.bzl", - file2 = "requirement_bzl", -) - -py_test( - name = "test_dependency_usage", - srcs = ["test_dependency_usage.py"], - deps = [ - requirement("requests"), - ], -) - -build_test( - name = "test_requirement_lists", - targets = all_requirements + all_whl_requirements + all_data_requirements, -) diff --git a/examples/pip_parse_vendored/README.md b/examples/pip_parse_vendored/README.md deleted file mode 100644 index baa51f5729..0000000000 --- a/examples/pip_parse_vendored/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# pip_parse vendored - -This example is like pip_parse, however we avoid loading from the generated file. -See https://github.com/bazel-contrib/rules_python/issues/608 -and https://blog.aspect.dev/avoid-eager-fetches. - -The requirements now form a triple: - -- requirements.in - human editable, expresses only direct dependencies and load-bearing version constraints -- requirements.txt - lockfile produced by pip-compile or other means -- requirements.bzl - the "parsed" version of the lockfile readable by Bazel downloader - -The `requirements.bzl` file contains baked-in attributes such as `python_interpreter_target` as they were specified in the original `pip_parse` rule. These can be overridden at install time by passing arguments to `install_deps`. For example: - -```python -# Register a hermetic toolchain -load("@rules_python//python:repositories.bzl", "python_register_toolchains") - -python_register_toolchains( - name = "python39", - python_version = "3.9", -) - -# Load dependencies vendored by some other ruleset. -load("@some_rules//:py_deps.bzl", "install_deps") - -install_deps( - python_interpreter_target = "@python39_host//:python", -) -``` diff --git a/examples/pip_parse_vendored/WORKSPACE b/examples/pip_parse_vendored/WORKSPACE deleted file mode 100644 index 5e80b4116b..0000000000 --- a/examples/pip_parse_vendored/WORKSPACE +++ /dev/null @@ -1,57 +0,0 @@ -workspace(name = "pip_parse_vendored_example") - -local_repository( - name = "rules_python", - path = "../..", -) - -load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains") - -py_repositories() - -python_register_toolchains( - name = "python39", - python_version = "3.9", -) - -load("@rules_python//python:pip.bzl", "pip_parse") - -# This repository isn't referenced, except by our test that asserts the requirements.bzl is updated. -# It also wouldn't be needed by users of this ruleset. -# If you're using envsubst with extra_pip_args, as we do below, the value of the environment -# variables at the time we generate requirements.bzl don't make it into the file, as you may -# verify by inspection; the environment variables at a later time, when we download the -# packages, will be the ones that take effect. -pip_parse( - # We choose a unique name here to make sure we can do some cleanup on it. - name = "pip_deps_to_be_vendored", - envsubst = ["PIP_RETRIES"], - extra_pip_args = ["--retries=${PIP_RETRIES:-5}"], - python_interpreter_target = "@python39_host//:python", - requirements_lock = "//:requirements.txt", -) - -# This example vendors the file produced by `pip_parse` above into the repo. -# This way our Bazel doesn't eagerly fetch and install the pip_parse'd -# repository for builds that don't need it. -# See discussion of the trade-offs in the pip_parse documentation -# and the "vendor_requirements" target in the BUILD file. -load("//:requirements.bzl", "install_deps") - -install_deps() - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -# See https://github.com/bazelbuild/rules_shell/releases/tag/v0.2.0 -http_archive( - name = "rules_shell", - sha256 = "410e8ff32e018b9efd2743507e7595c26e2628567c42224411ff533b57d27c28", - strip_prefix = "rules_shell-0.2.0", - url = "https://github.com/bazelbuild/rules_shell/releases/download/v0.2.0/rules_shell-v0.2.0.tar.gz", -) - -load("@rules_shell//shell:repositories.bzl", "rules_shell_dependencies", "rules_shell_toolchains") - -rules_shell_dependencies() - -rules_shell_toolchains() diff --git a/examples/pip_parse_vendored/requirements.bzl b/examples/pip_parse_vendored/requirements.bzl deleted file mode 100644 index f5551573fb..0000000000 --- a/examples/pip_parse_vendored/requirements.bzl +++ /dev/null @@ -1,122 +0,0 @@ -"""Starlark representation of locked requirements. - -@generated by rules_python pip_parse repository rule. -""" - -load("@rules_python//python:pip.bzl", "pip_utils") -load("@rules_python//python/pip_install:pip_repository.bzl", "whl_config_repo", "whl_library") - -all_requirements = [ - "@my_project_pip_deps_vendored_certifi//:pkg", - "@my_project_pip_deps_vendored_charset_normalizer//:pkg", - "@my_project_pip_deps_vendored_idna//:pkg", - "@my_project_pip_deps_vendored_requests//:pkg", - "@my_project_pip_deps_vendored_urllib3//:pkg", -] - -all_whl_requirements_by_package = { - "certifi": "@my_project_pip_deps_vendored_certifi//:whl", - "charset_normalizer": "@my_project_pip_deps_vendored_charset_normalizer//:whl", - "idna": "@my_project_pip_deps_vendored_idna//:whl", - "requests": "@my_project_pip_deps_vendored_requests//:whl", - "urllib3": "@my_project_pip_deps_vendored_urllib3//:whl", -} - -all_whl_requirements = all_whl_requirements_by_package.values() - -all_data_requirements = [ - "@my_project_pip_deps_vendored_certifi//:data", - "@my_project_pip_deps_vendored_charset_normalizer//:data", - "@my_project_pip_deps_vendored_idna//:data", - "@my_project_pip_deps_vendored_requests//:data", - "@my_project_pip_deps_vendored_urllib3//:data", -] - -_packages = [ - ("my_project_pip_deps_vendored_certifi", "certifi==2023.7.22 --hash=sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082 --hash=sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9"), - ("my_project_pip_deps_vendored_charset_normalizer", "charset-normalizer==2.1.1 --hash=sha256:5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845 --hash=sha256:83e9a75d1911279afd89352c68b45348559d1fc0506b054b346651b5e7fee29f"), - ("my_project_pip_deps_vendored_idna", "idna==3.4 --hash=sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4 --hash=sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"), - ("my_project_pip_deps_vendored_requests", "requests==2.28.1 --hash=sha256:7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983 --hash=sha256:8fefa2a1a1365bf5520aac41836fbee479da67864514bdb821f31ce07ce65349"), - ("my_project_pip_deps_vendored_urllib3", "urllib3==1.26.13 --hash=sha256:47cc05d99aaa09c9e72ed5809b60e7ba354e64b59c9c173ac3018642d8bb41fc --hash=sha256:c083dd0dce68dbfbe1129d5271cb90f9447dea7d52097c6e0126120c521ddea8"), -] -_config = { - "download_only": False, - "enable_implicit_namespace_pkgs": False, - "environment": {}, - "envsubst": ["PIP_RETRIES"], - "extra_pip_args": ["--retries=${PIP_RETRIES:-5}"], - "isolated": True, - "pip_data_exclude": [], - "python_interpreter": "python3", - "python_interpreter_target": "@python39_host//:python", - "quiet": True, - "repo": "my_project_pip_deps_vendored", - "repo_prefix": "my_project_pip_deps_vendored_", - "timeout": 600, -} -_annotations = {} - -def requirement(name): - return "@my_project_pip_deps_vendored_{}//:{}".format(pip_utils.normalize_name(name), "pkg") - -def whl_requirement(name): - return "@my_project_pip_deps_vendored_{}//:{}".format(pip_utils.normalize_name(name), "whl") - -def data_requirement(name): - return "@my_project_pip_deps_vendored_{}//:{}".format(pip_utils.normalize_name(name), "data") - -def dist_info_requirement(name): - return "@my_project_pip_deps_vendored_{}//:{}".format(pip_utils.normalize_name(name), "dist_info") - -def _get_annotation(requirement): - # This expects to parse `setuptools==58.2.0 --hash=sha256:2551203ae6955b9876741a26ab3e767bb3242dafe86a32a749ea0d78b6792f11` - # down to `setuptools`. - name = requirement.split(" ")[0].split("=")[0].split("[")[0] - return _annotations.get(name) - -def install_deps(**whl_library_kwargs): - """Repository rule macro. Install dependencies from `pip_parse`. - - Args: - **whl_library_kwargs: Additional arguments which will flow to underlying - `whl_library` calls. See pip_repository.bzl for details. - """ - - # Set up the requirement groups - all_requirement_groups = {} - - requirement_group_mapping = { - requirement: group_name - for group_name, group_requirements in all_requirement_groups.items() - for requirement in group_requirements - } - - config_repo = "my_project_pip_deps_vendored__config" - whl_config_repo( - name = "my_project_pip_deps_vendored__config", - repo_prefix = "my_project_pip_deps_vendored_", - groups = all_requirement_groups, - whl_map = { - p: "" - for p in all_whl_requirements_by_package - }, - ) - config_load = "@{}//:config.bzl".format(config_repo) - - # Install wheels which may be participants in a group - whl_config = dict(_config) - whl_config.update(whl_library_kwargs) - - for name, requirement in _packages: - group_name = requirement_group_mapping.get(name.replace("my_project_pip_deps_vendored_", "")) - group_deps = all_requirement_groups.get(group_name, []) - - whl_library( - name = name, - requirement = requirement, - group_name = group_name, - group_deps = group_deps, - annotation = _get_annotation(requirement), - config_load = config_load, - **whl_config - ) diff --git a/examples/pip_parse_vendored/requirements.in b/examples/pip_parse_vendored/requirements.in deleted file mode 100644 index 7ec4233fa4..0000000000 --- a/examples/pip_parse_vendored/requirements.in +++ /dev/null @@ -1,2 +0,0 @@ -requests -certifi>=2023.7.22 # https://security.snyk.io/vuln/SNYK-PYTHON-CERTIFI-5805047 diff --git a/examples/pip_parse_vendored/requirements.txt b/examples/pip_parse_vendored/requirements.txt deleted file mode 100644 index 75b45a1ce3..0000000000 --- a/examples/pip_parse_vendored/requirements.txt +++ /dev/null @@ -1,28 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.9 -# by the following command: -# -# bazel run //:requirements.update -# -certifi==2023.7.22 \ - --hash=sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082 \ - --hash=sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9 - # via - # -r requirements.in - # requests -charset-normalizer==2.1.1 \ - --hash=sha256:5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845 \ - --hash=sha256:83e9a75d1911279afd89352c68b45348559d1fc0506b054b346651b5e7fee29f - # via requests -idna==3.4 \ - --hash=sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4 \ - --hash=sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2 - # via requests -requests==2.28.1 \ - --hash=sha256:7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983 \ - --hash=sha256:8fefa2a1a1365bf5520aac41836fbee479da67864514bdb821f31ce07ce65349 - # via -r requirements.in -urllib3==1.26.13 \ - --hash=sha256:47cc05d99aaa09c9e72ed5809b60e7ba354e64b59c9c173ac3018642d8bb41fc \ - --hash=sha256:c083dd0dce68dbfbe1129d5271cb90f9447dea7d52097c6e0126120c521ddea8 - # via requests diff --git a/examples/pip_parse_vendored/test_dependency_usage.py b/examples/pip_parse_vendored/test_dependency_usage.py deleted file mode 100644 index e2cf970d9d..0000000000 --- a/examples/pip_parse_vendored/test_dependency_usage.py +++ /dev/null @@ -1,12 +0,0 @@ -import unittest - -import requests - - -class TestDependencies(unittest.TestCase): - def test_import(self): - self.assertIsNotNone(requests.get) - - -if __name__ == "__main__": - unittest.main() From e40d4a3a7b8ac5f3bf5ad652b26948252c607aa7 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sat, 16 May 2026 13:02:20 +0900 Subject: [PATCH 2/3] first round of cleanup --- .../scripts/get_buildkite_results.py | 16 +- docs/getting-started.md | 43 +- docs/howto/pypi-headers.md | 29 +- docs/pypi/circular-dependencies.md | 6 +- docs/pypi/download-workspace.md | 106 ----- docs/pypi/download.md | 20 +- docs/pypi/index.md | 3 +- docs/pypi/lock.md | 2 +- docs/pypi/use.md | 10 +- docs/toolchains.md | 96 +---- .../other_module/other_module_import_test.py | 3 + examples/wheel/wheel_test.py | 8 +- gazelle/manifest/copy_to_source.py | 4 +- gazelle/modules_mapping/test_merger.py | 4 +- .../dependency_resolution_order/__init__.py | 3 +- .../import_nested_var/__init__.py | 6 +- .../naming_convention_mapped_fail/__init__.py | 2 +- .../naming_convention_mapped_fail/__main__.py | 2 +- .../naming_convention_mapped_fail/__test__.py | 2 +- .../package1/subpackage1/__init__.py | 1 - .../package1/subpackage1/some_module.py | 1 - .../subpackage1/subpackage2/script.py | 12 +- python/BUILD.bazel | 5 - python/bin/repl_stub.py | 3 +- python/pip.bzl | 27 +- python/pip_install/BUILD.bazel | 11 - python/pip_install/pip_repository.bzl | 27 -- python/private/get_local_runtime_info.py | 20 +- python/private/pypi/BUILD.bazel | 51 --- .../dependency_resolver.py | 4 +- python/private/pypi/multi_pip_parse.bzl | 166 -------- python/private/pypi/package_annotation.bzl | 49 --- python/private/pypi/parse_requirements.bzl | 51 --- python/private/pypi/pip_repository.bzl | 381 ------------------ .../pypi/requirements.bzl.tmpl.workspace | 74 ---- python/private/pypi/whl_config_repo.bzl | 46 --- python/private/pypi/whl_library_alias.bzl | 103 ----- sphinxdocs/sphinxdocs/private/sphinx_build.py | 8 +- tests/bootstrap_impls/bin_calls_bin/inner.py | 1 + .../bin_calls_bin/inner_lib.py | 2 +- .../abi3_headers_linkage_test.py | 4 +- tests/integration/custom_commands_test.py | 7 +- .../pip_parse_isolated/test_isolated.py | 3 +- .../toolchain_target_settings/main.py | 1 + .../custom_platform_toolchain_test.py | 3 +- tests/tools/wheelmaker_test.py | 12 +- tools/wheelmaker.py | 36 +- 47 files changed, 110 insertions(+), 1364 deletions(-) delete mode 100644 docs/pypi/download-workspace.md delete mode 100644 python/pip_install/pip_repository.bzl delete mode 100644 python/private/pypi/multi_pip_parse.bzl delete mode 100644 python/private/pypi/package_annotation.bzl delete mode 100644 python/private/pypi/pip_repository.bzl delete mode 100644 python/private/pypi/requirements.bzl.tmpl.workspace delete mode 100644 python/private/pypi/whl_config_repo.bzl delete mode 100644 python/private/pypi/whl_library_alias.bzl diff --git a/.agents/skills/buildkite-get-results/scripts/get_buildkite_results.py b/.agents/skills/buildkite-get-results/scripts/get_buildkite_results.py index eb5532e4d6..e1fc635cf6 100755 --- a/.agents/skills/buildkite-get-results/scripts/get_buildkite_results.py +++ b/.agents/skills/buildkite-get-results/scripts/get_buildkite_results.py @@ -85,7 +85,10 @@ def fetch_buildkite_data(build_url): elif isinstance(jobs_data, dict) and "records" in jobs_data: data["jobs"] = jobs_data["records"] except Exception as e: - print(f"Warning: Could not fetch detailed jobs from {jobs_url}: {e}", file=sys.stderr) + print( + f"Warning: Could not fetch detailed jobs from {jobs_url}: {e}", + file=sys.stderr, + ) return data @@ -165,15 +168,18 @@ def main(): build_state = data.get("state", "Unknown") print(f"Build State: {build_state}") - + jobs = data.get("jobs", []) jobs_count = data.get("statistics", {}).get("jobs_count", 0) - + print(f"Total jobs reported: {jobs_count}") print(f"Jobs found in data: {len(jobs)}") - + if jobs_count != len(jobs): - print(f"WARNING: Reported job count ({jobs_count}) does not match jobs found ({len(jobs)}).", file=sys.stderr) + print( + f"WARNING: Reported job count ({jobs_count}) does not match jobs found ({len(jobs)}).", + file=sys.stderr, + ) print("-" * 40) diff --git a/docs/getting-started.md b/docs/getting-started.md index 6494b37c51..ee691cf303 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -32,50 +32,11 @@ pip.parse( use_repo(pip, "pypi") ``` -### Using a WORKSPACE file - -Using `WORKSPACE` is deprecated but still supported, and it's a bit more involved than -using Bzlmod. Here is a simplified setup to download the prebuilt runtimes. - -```starlark -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -# Update the snippet based on the latest release below -# https://github.com/bazel-contrib/rules_python/releases - -http_archive( - name = "rules_python", - sha256 = "ca77768989a7f311186a29747e3e95c936a41dffac779aff6b443db22290d913", - strip_prefix = "rules_python-0.36.0", - url = "https://github.com/bazel-contrib/rules_python/releases/download/0.36.0/rules_python-0.36.0.tar.gz", -) - -load("@rules_python//python:repositories.bzl", "py_repositories") - -py_repositories() - -load("@rules_python//python:repositories.bzl", "python_register_toolchains") - -python_register_toolchains( - name = "python_3_11", - # Available versions are listed in @rules_python//python:versions.bzl. - # We recommend using the same version your team is already standardized on. - python_version = "3.11", -) - -load("@rules_python//python:pip.bzl", "pip_parse") - -pip_parse( - name = "pypi", - python_interpreter_target = "@python_3_11_host//:python", - requirements_lock = "//:requirements.txt", -) -``` ## "Hello World" -Once you've imported the rule set using either Bzlmod or `WORKSPACE`, you can then -load the core rules in your `BUILD` files with the following: +Once you've imported the rule set using Bzlmod, you can then load the core rules +in your `BUILD` files with the following: ```starlark load("@rules_python//python:py_binary.bzl", "py_binary") diff --git a/docs/howto/pypi-headers.md b/docs/howto/pypi-headers.md index 3675031096..a8dd6a8827 100644 --- a/docs/howto/pypi-headers.md +++ b/docs/howto/pypi-headers.md @@ -65,34 +65,7 @@ pip.parse( ## WORKSPACE setup -In your `WORKSPACE` file, use the `annotations` attribute of `pip_parse` to -inject additional `BUILD` file content, then use `extra_hub_targets` to expose -that target in the `@pypi` hub repo. - -The {obj}`package_annotation` helper can be used to construct the value for the -`annotations` attribute. - -```starlark -# WORKSPACE -load("@rules_python//python:pip.bzl", "package_annotation", "pip_parse") - -pip_parse( - name = "pypi", - requirements_lock = "//:requirements.txt", - annotations = { - "numpy": package_annotation( - additive_build_content = """\ -load("@//:pypi_extra_targets.bzl", "numpy_hdrs") - -extra_numpy_targets() -""" - ), - }, - extra_hub_targets = { - "numpy": ["headers"], - }, -) -``` +WORKSPACE mode is deprecated. Use [bzlmod](../pypi/download) instead. ## Using the headers diff --git a/docs/pypi/circular-dependencies.md b/docs/pypi/circular-dependencies.md index 62613f489e..61ca01cb33 100644 --- a/docs/pypi/circular-dependencies.md +++ b/docs/pypi/circular-dependencies.md @@ -32,8 +32,8 @@ ERROR: .../external/pypi_sphinxcontrib_serializinghtml/BUILD.bazel:44:6: in alia ``` The `experimental_requirement_cycles` attribute allows you to work around these -issues by specifying groups of packages which form cycles. `pip_parse` will -transparently fix the cycles for you and provide the cyclic dependencies +issues by specifying groups of packages which form cycles. The `pip` extension +will transparently fix the cycles for you and provide the cyclic dependencies simultaneously. ```starlark @@ -47,7 +47,7 @@ simultaneously. ) ``` -`pip_parse` supports fixing multiple cycles simultaneously, however, cycles must +The `pip` extension supports fixing multiple cycles simultaneously, however, cycles must be distinct. `apache-airflow`, for instance, has dependency cycles with a number of its optional dependencies, which means those optional dependencies must all be a part of the `airflow` cycle. For instance: diff --git a/docs/pypi/download-workspace.md b/docs/pypi/download-workspace.md deleted file mode 100644 index 4912f71103..0000000000 --- a/docs/pypi/download-workspace.md +++ /dev/null @@ -1,106 +0,0 @@ -:::{default-domain} bzl -::: - -# Download (WORKSPACE) - -This documentation page covers how to download PyPI dependencies in the legacy `WORKSPACE` setup. - -To add pip dependencies to your `WORKSPACE`, load the `pip_parse` function and -call it to create the central external repo and individual wheel external repos. - -```starlark -load("@rules_python//python:pip.bzl", "pip_parse") - -# Create a central repo that knows about the dependencies needed from -# requirements_lock.txt. -pip_parse( - name = "my_deps", - requirements_lock = "//path/to:requirements_lock.txt", -) - -# Load the starlark macro, which will define your dependencies. -load("@my_deps//:requirements.bzl", "install_deps") - -# Call it to define repos for your requirements. -install_deps() -``` - -## Interpreter selection - -Note that because `pip_parse` runs before Bazel decides which Python toolchain to use, it cannot -enforce that the interpreter used to invoke `pip` matches the interpreter used to run `py_binary` -targets. By default, `pip_parse` uses the system command `"python3"`. To override this, pass in the -{attr}`pip_parse.python_interpreter` attribute or {attr}`pip_parse.python_interpreter_target`. - -You can have multiple `pip_parse`s in the same workspace. This configuration will create multiple -external repos that have no relation to one another and may result in downloading the same wheels -numerous times. - -As with any repository rule, if you would like to ensure that `pip_parse` is -re-executed to pick up a non-hermetic change to your environment (e.g., updating -your system `python` interpreter), you can force it to re-execute by running -`bazel sync --only [pip_parse name]`. - -## Requirements for a specific OS/Architecture - -In some cases, you may need to use different requirements files for different OS and architecture combinations. -This is enabled via the {attr}`pip_parse.requirements_by_platform` attribute. The keys of the -dictionary are labels to the file, and the values are a list of comma-separated target (os, arch) -tuples. - -For example: -```starlark - # ... - requirements_by_platform = { - "requirements_linux_x86_64.txt": "linux_x86_64", - "requirements_osx.txt": "osx_*", - "requirements_linux_exotic.txt": "linux_exotic", - "requirements_some_platforms.txt": "linux_aarch64,windows_*", - }, - # For the list of standard platforms that the rules_python has toolchains for, default to - # the following requirements file. - requirements_lock = "requirements_lock.txt", -``` - -In case of duplicate platforms, `rules_python` will raise an error, as there has -to be an unambiguous mapping of the requirement files to the (os, arch) tuples. - -An alternative way is to use per-OS requirement attributes. -```starlark - # ... - requirements_windows = "requirements_windows.txt", - requirements_darwin = "requirements_darwin.txt", - # For the remaining platforms (which is basically only linux OS), use this file. - requirements_lock = "requirements_lock.txt", -) -``` - -:::{note} -If you are using a universal lock file but want to restrict the list of platforms that -the lock file will be evaluated against, consider using the aforementioned -`requirements_by_platform` attribute and listing the platforms explicitly. -::: - -(vendoring-requirements)= -## Vendoring the requirements.bzl file - -:::{note} -For `bzlmod`, refer to standard `bazel vendor` usage if you want to really vendor it, otherwise -just use the `pip` extension as you would normally. - -However, be aware that there are caveats when doing so. -::: - -In some cases you may not want to generate the requirements.bzl file as a repository rule -while Bazel is fetching dependencies. For example, if you produce a reusable Bazel module -such as a ruleset, you may want to include the `requirements.bzl` file rather than make your users -install the `WORKSPACE` setup to generate it, see {gh-issue}`608`. - -This is the same workflow as Gazelle, which creates `go_repository` rules with -[`update-repos`](https://github.com/bazelbuild/bazel-gazelle#update-repos) - -To do this, use the "write to source file" pattern documented in - -to put a copy of the generated `requirements.bzl` into your project. -Then load the requirements.bzl file directly rather than from the generated repository. -See the example in {gh-path}`examples/pip_parse_vendored`. diff --git a/docs/pypi/download.md b/docs/pypi/download.md index f0e70cf850..f9c0f60ade 100644 --- a/docs/pypi/download.md +++ b/docs/pypi/download.md @@ -3,9 +3,6 @@ # Download (bzlmod) -:::{seealso} -For WORKSPACE instructions see [here](./download-workspace). -::: To add PyPI dependencies to your `MODULE.bazel` file, use the `pip.parse` extension and call it to create the central external repo and individual wheel @@ -50,10 +47,9 @@ You can use the pip extension multiple times. This configuration will create multiple external repos that have no relation to one another and may result in downloading the same wheels numerous times. -As with any repository rule or extension, if you would like to ensure that `pip_parse` is -re-executed to pick up a non-hermetic change to your environment (e.g., updating your system -`python` interpreter), you can force it to re-execute by running `bazel sync --only [pip_parse -name]`. +If you would like to ensure that `pip` extension picks up non-hermetic changes +to your environment (e.g., updating your system `python` interpreter), you can +force it to re-execute via `bazel mod deps --repin`. (per-os-arch-requirements)= ## Requirements for a specific OS/Architecture @@ -98,11 +94,11 @@ the lock file will be evaluated against, consider using the aforementioned ## Multi-platform support -Historically, the {obj}`pip_parse` and {obj}`pip.parse` have only been downloading/building -Python dependencies for the host platform that the `bazel` commands are executed on. Over -the years, people started needing support for building containers, and usually, that involves -fetching dependencies for a particular target platform that may be different from the host -platform. +Historically, the {obj}`pip.parse` bzlmod extension only downloaded/built Python +dependencies for the host platform that the `bazel` commands are executed on. +Over the years, people started needing support for building containers, and +usually, that involves fetching dependencies for a particular target platform +that may be different from the host platform. Multi-platform support for cross-building the wheels can be done by using {attr}`target_platforms` for the {bzl:obj}`pip.parse` bzlmod tag class diff --git a/docs/pypi/index.md b/docs/pypi/index.md index 2d17dd5054..6bd6e74c96 100644 --- a/docs/pypi/index.md +++ b/docs/pypi/index.md @@ -7,7 +7,7 @@ Using PyPI packages (aka "pip install") involves the following main steps: 1. [Generating requirements file](./lock) -2. Installing third-party packages in [bzlmod](./download) or [WORKSPACE](./download-workspace). +2. [Installing third-party packages via bzlmod](./download). 3. [Using third-party packages as dependencies](./use) With the advanced topics covered separately: @@ -17,7 +17,6 @@ With the advanced topics covered separately: ```{toctree} lock download -download-workspace use ``` diff --git a/docs/pypi/lock.md b/docs/pypi/lock.md index b5d8ec24f7..40e3f21fbf 100644 --- a/docs/pypi/lock.md +++ b/docs/pypi/lock.md @@ -36,7 +36,7 @@ This rule generates two targets: - `bazel run [name].update` will regenerate the `requirements_txt` file - `bazel test [name]_test` will test that the `requirements_txt` file is up to date -Once you generate this fully specified list of requirements, you can install the requirements ([bzlmod](./download)/[WORKSPACE](./download-workspace)). +Once you generate this fully specified list of requirements, you can [install the requirements via bzlmod](./download). :::{warning} If you're specifying dependencies in `pyproject.toml`, make sure to include the diff --git a/docs/pypi/use.md b/docs/pypi/use.md index 9d0c54c4ab..2beca3447d 100644 --- a/docs/pypi/use.md +++ b/docs/pypi/use.md @@ -4,9 +4,7 @@ # Use in BUILD.bazel files Once you have set up the dependencies, you are ready to start using them in your `BUILD.bazel` -files. If you haven't done so yet, set it up by following these docs: -1. [WORKSPACE](./download-workspace) -2. [bzlmod](./download) +files. If you haven't done so yet, set it up by following the [bzlmod docs](./download). To refer to targets in a hub repo `pypi`, you can do one of two things: ```starlark @@ -85,7 +83,7 @@ filegroup( The rule {obj}`whl_filegroup` exists as an easy way to extract the necessary files from a whl file without needing to modify the `BUILD.bazel` contents of the -whl repositories generated via `pip_repository`. Use it similarly to the `filegroup` +whl repositories. Use it similarly to the `filegroup` above. See the API docs for more information. (requirement-helper)= @@ -123,13 +121,13 @@ On the other hand, using the `requirement()` helper has several drawbacks: - It does not scale well, as each type of target needs a new macro to be loaded and imported. If you don't want to use `requirement()`, you can use the library labels directly instead. For -`pip_parse`, the labels are of the following form: +the `pip` extension, the labels are of the following form: ```starlark @{name}//{package} ``` -Here `name` is the `name` attribute that was passed to `pip_parse` and +Here `name` is the `hub_name` attribute that was passed to the `pip` extension and `package` is the pip package name with characters that are illegal in Bazel label names (e.g. `-`, `.`) replaced with `_`. If you need to update `name` from "old" to "new", then you can run the following diff --git a/docs/toolchains.md b/docs/toolchains.md index 09aaed412b..ffc31d45ee 100644 --- a/docs/toolchains.md +++ b/docs/toolchains.md @@ -312,99 +312,15 @@ Added support for custom platform names, `target_compatible_with`, and ### Using defined toolchains from WORKSPACE -It is possible to use toolchains defined in `MODULE.bazel` in `WORKSPACE`. For example, -the following `MODULE.bazel` and `WORKSPACE` provides a working {bzl:obj}`pip_parse` setup: -```starlark -# File: WORKSPACE -load("@rules_python//python:repositories.bzl", "py_repositories") - -py_repositories() - -load("@rules_python//python:pip.bzl", "pip_parse") - -pip_parse( - name = "third_party", - requirements_lock = "//:requirements.txt", - python_interpreter_target = "@python_3_10_host//:python", -) - -load("@third_party//:requirements.bzl", "install_deps") - -install_deps() - -# File: MODULE.bazel -bazel_dep(name = "rules_python", version = "0.40.0") - -python = use_extension("@rules_python//python/extensions:python.bzl", "python") - -python.defaults(python_version = "3.10") -python.toolchain(python_version = "3.10") - -use_repo(python, "python_3_10", "python_3_10_host") -``` - -Note, the user has to import the `*_host` repository to use the Python interpreter in the -{bzl:obj}`pip_parse` and `whl_library` repository rules, and once that is done, -users should be able to ensure the setting of the default toolchain even during the -transition period when some of the code is still defined in `WORKSPACE`. +:::{deprecated} 1.0.0 +WORKSPACE mode is deprecated. Use [bzlmod](../pypi/download) instead. +::: ## Workspace configuration -To import `rules_python` in your project, you first need to add it to your -`WORKSPACE` file, using the snippet provided in the -[release you choose](https://github.com/bazel-contrib/rules_python/releases). - -To depend on a particular unreleased version, you can do the following: - -```starlark -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - - -# Update the SHA and VERSION to the lastest version available here: -# https://github.com/bazel-contrib/rules_python/releases. - -SHA="84aec9e21cc56fbc7f1335035a71c850d1b9b5cc6ff497306f84cced9a769841" - -VERSION="0.23.1" - -http_archive( - name = "rules_python", - sha256 = SHA, - strip_prefix = "rules_python-{}".format(VERSION), - url = "https://github.com/bazel-contrib/rules_python/releases/download/{}/rules_python-{}.tar.gz".format(VERSION,VERSION), -) - -load("@rules_python//python:repositories.bzl", "py_repositories") - -py_repositories() -``` - -### Workspace toolchain registration - -To register a hermetic Python toolchain rather than rely on a system-installed interpreter for runtime execution, you can add to the `WORKSPACE` file: - -```starlark -load("@rules_python//python:repositories.bzl", "python_register_toolchains") - -python_register_toolchains( - name = "python_3_11", - # Available versions are listed in @rules_python//python:versions.bzl. - # We recommend using the same version your team is already standardized on. - python_version = "3.11", -) - -load("@rules_python//python:pip.bzl", "pip_parse") - -pip_parse( - ... - python_interpreter_target = "@python_3_11_host//:python", - ... -) -``` - -After registration, your Python targets will use the toolchain's interpreter during execution, but a system-installed interpreter -is still used to "bootstrap" Python targets (see https://github.com/bazel-contrib/rules_python/issues/691). -You may also find some quirks while using this toolchain. Please refer to [python-build-standalone documentation's _Quirks_ section](https://gregoryszorc.com/docs/python-build-standalone/main/quirks.html). +:::{deprecated} 1.0.0 +WORKSPACE mode is deprecated. Use [bzlmod](../pypi/download) instead. +::: ## Local toolchain diff --git a/examples/bzlmod/tests/other_module/other_module_import_test.py b/examples/bzlmod/tests/other_module/other_module_import_test.py index 6b92a853e0..b5b15c383d 100644 --- a/examples/bzlmod/tests/other_module/other_module_import_test.py +++ b/examples/bzlmod/tests/other_module/other_module_import_test.py @@ -1,8 +1,10 @@ """Regression test for https://github.com/bazel-contrib/rules_python/issues/3563""" + import os import subprocess import sys + def main(): # The rlocation path for the bin_zipapp. It is in the "our_other_module" repository. zipapp_path = os.environ.get("ZIPAPP_PATH") @@ -18,5 +20,6 @@ def main(): print(f"bin_zippapp failed with return code {result.returncode}") sys.exit(result.returncode) + if __name__ == "__main__": main() diff --git a/examples/wheel/wheel_test.py b/examples/wheel/wheel_test.py index 9ed2b842e5..73b314bfb8 100644 --- a/examples/wheel/wheel_test.py +++ b/examples/wheel/wheel_test.py @@ -566,7 +566,9 @@ def test_extra_requires(self): ) def test_requires_dist_depends_on_extras(self): - filename = self._get_path("requires_dist_depends_on_extras-0.0.1-py3-none-any.whl") + filename = self._get_path( + "requires_dist_depends_on_extras-0.0.1-py3-none-any.whl" + ) with zipfile.ZipFile(filename) as zf: self.assertAllEntriesHasReproducibleMetadata(zf) @@ -591,7 +593,9 @@ def test_requires_dist_depends_on_extras(self): ) def test_requires_dist_depends_on_extras_file(self): - filename = self._get_path("requires_dist_depends_on_extras_using_file-0.0.1-py3-none-any.whl") + filename = self._get_path( + "requires_dist_depends_on_extras_using_file-0.0.1-py3-none-any.whl" + ) with zipfile.ZipFile(filename) as zf: self.assertAllEntriesHasReproducibleMetadata(zf) diff --git a/gazelle/manifest/copy_to_source.py b/gazelle/manifest/copy_to_source.py index b897b1fcf3..db3e7c987e 100644 --- a/gazelle/manifest/copy_to_source.py +++ b/gazelle/manifest/copy_to_source.py @@ -20,7 +20,9 @@ def copy_to_source(generated_relative_path: Path, target_relative_path: Path) -> generated_absolute_path = Path.cwd() / generated_relative_path # Similarly, the target is relative to the source directory. - target_absolute_path = os.environ["BUILD_WORKSPACE_DIRECTORY"] / target_relative_path + target_absolute_path = ( + os.environ["BUILD_WORKSPACE_DIRECTORY"] / target_relative_path + ) print(f"Copying {generated_absolute_path} to {target_absolute_path}") target_absolute_path.parent.mkdir(parents=True, exist_ok=True) diff --git a/gazelle/modules_mapping/test_merger.py b/gazelle/modules_mapping/test_merger.py index 6260fdd6ff..87c35f4404 100644 --- a/gazelle/modules_mapping/test_merger.py +++ b/gazelle/modules_mapping/test_merger.py @@ -1,7 +1,7 @@ -import pathlib -import unittest import json +import pathlib import tempfile +import unittest from merger import merge_modules_mappings diff --git a/gazelle/python/testdata/dependency_resolution_order/__init__.py b/gazelle/python/testdata/dependency_resolution_order/__init__.py index 4b40aa9f54..8149451117 100644 --- a/gazelle/python/testdata/dependency_resolution_order/__init__.py +++ b/gazelle/python/testdata/dependency_resolution_order/__init__.py @@ -17,12 +17,11 @@ import bar import baz import foo +import third_party # Ensure that even though @gazelle_python_test//other_pip_dep provides "third_party", # we can still override "third_party.foo.bar" import third_party.foo.bar - -import third_party from third_party import baz _ = sys diff --git a/gazelle/python/testdata/from_imports/import_nested_var/__init__.py b/gazelle/python/testdata/from_imports/import_nested_var/__init__.py index 20eda530e5..d0f51c443c 100644 --- a/gazelle/python/testdata/from_imports/import_nested_var/__init__.py +++ b/gazelle/python/testdata/from_imports/import_nested_var/__init__.py @@ -13,8 +13,4 @@ # limitations under the License. # baz is a variable in foo/bar/baz.py -from foo\ - .bar.\ - baz import ( - baz - ) +from foo.bar.baz import baz diff --git a/gazelle/python/testdata/naming_convention_mapped_fail/__init__.py b/gazelle/python/testdata/naming_convention_mapped_fail/__init__.py index a75c47faaf..47689a9ddc 100644 --- a/gazelle/python/testdata/naming_convention_mapped_fail/__init__.py +++ b/gazelle/python/testdata/naming_convention_mapped_fail/__init__.py @@ -1 +1 @@ -# Empty test file. \ No newline at end of file +# Empty test file. diff --git a/gazelle/python/testdata/naming_convention_mapped_fail/__main__.py b/gazelle/python/testdata/naming_convention_mapped_fail/__main__.py index a75c47faaf..47689a9ddc 100644 --- a/gazelle/python/testdata/naming_convention_mapped_fail/__main__.py +++ b/gazelle/python/testdata/naming_convention_mapped_fail/__main__.py @@ -1 +1 @@ -# Empty test file. \ No newline at end of file +# Empty test file. diff --git a/gazelle/python/testdata/naming_convention_mapped_fail/__test__.py b/gazelle/python/testdata/naming_convention_mapped_fail/__test__.py index a75c47faaf..47689a9ddc 100644 --- a/gazelle/python/testdata/naming_convention_mapped_fail/__test__.py +++ b/gazelle/python/testdata/naming_convention_mapped_fail/__test__.py @@ -1 +1 @@ -# Empty test file. \ No newline at end of file +# Empty test file. diff --git a/gazelle/python/testdata/relative_imports_package_mode/package1/subpackage1/__init__.py b/gazelle/python/testdata/relative_imports_package_mode/package1/subpackage1/__init__.py index 02feaeb848..44cf2f9249 100644 --- a/gazelle/python/testdata/relative_imports_package_mode/package1/subpackage1/__init__.py +++ b/gazelle/python/testdata/relative_imports_package_mode/package1/subpackage1/__init__.py @@ -1,3 +1,2 @@ - def some_init(): return "some_init" diff --git a/gazelle/python/testdata/relative_imports_package_mode/package1/subpackage1/some_module.py b/gazelle/python/testdata/relative_imports_package_mode/package1/subpackage1/some_module.py index 3cae706242..aaa161cd59 100644 --- a/gazelle/python/testdata/relative_imports_package_mode/package1/subpackage1/some_module.py +++ b/gazelle/python/testdata/relative_imports_package_mode/package1/subpackage1/some_module.py @@ -1,3 +1,2 @@ - def some_function(): return "some_function" diff --git a/gazelle/python/testdata/relative_imports_package_mode/package1/subpackage1/subpackage2/script.py b/gazelle/python/testdata/relative_imports_package_mode/package1/subpackage1/subpackage2/script.py index e93f07719a..8302e031b8 100644 --- a/gazelle/python/testdata/relative_imports_package_mode/package1/subpackage1/subpackage2/script.py +++ b/gazelle/python/testdata/relative_imports_package_mode/package1/subpackage1/subpackage2/script.py @@ -1,11 +1,11 @@ from ...my_library import ( some_function, ) # Import path should be package1.my_library.some_function -from ...my_library.foo import ( +from ...my_library.foo import ( # Import path should be package1.my_library.foo.some_function some_function, -) # Import path should be package1.my_library.foo.some_function -from .library import ( - other_module, -) # Import path should be package1.subpackage1.subpackage2.library.other_module -from .. import some_module # Import path should be package1.subpackage1.some_module +) from .. import some_function # Import path should be package1.subpackage1.some_function +from .. import some_module # Import path should be package1.subpackage1.some_module +from .library import ( # Import path should be package1.subpackage1.subpackage2.library.other_module + other_module, +) diff --git a/python/BUILD.bazel b/python/BUILD.bazel index 90b2225ab5..91ed43deb8 100644 --- a/python/BUILD.bazel +++ b/python/BUILD.bazel @@ -101,12 +101,7 @@ bzl_library( name = "pip_bzl", srcs = ["pip.bzl"], deps = [ - "//python/private:normalize_name_bzl", - "//python/private/pypi:multi_pip_parse_bzl", - "//python/private/pypi:package_annotation_bzl", "//python/private/pypi:pip_compile_bzl", - "//python/private/pypi:pip_repository_bzl", - "//python/private/pypi:whl_library_alias_bzl", "//python/private/whl_filegroup:whl_filegroup_bzl", ], ) diff --git a/python/bin/repl_stub.py b/python/bin/repl_stub.py index f5b7c0aa4f..774e787b1a 100644 --- a/python/bin/repl_stub.py +++ b/python/bin/repl_stub.py @@ -63,8 +63,7 @@ def complete(self, text, state): readline.parse_and_bind("tab: complete") else: print( - "Could not enable tab completion: " - "unable to determine readline backend" + "Could not enable tab completion: " "unable to determine readline backend" ) except ImportError: print( diff --git a/python/pip.bzl b/python/pip.bzl index 44ee69d65b..15fc2e7c40 100644 --- a/python/pip.bzl +++ b/python/pip.bzl @@ -14,36 +14,11 @@ """Rules for pip integration. This contains a set of rules that are used to support inclusion of third-party -dependencies via fully locked `requirements.txt` files. Some of the exported -symbols should not be used and they are either undocumented here or marked as -for internal use only. - -If you are using a bazel version 7 or above with `bzlmod`, you should only care -about the {bzl:obj}`compile_pip_requirements` macro exposed in this file. The -rest of the symbols are for legacy `WORKSPACE` setups. +dependencies via fully locked `requirements.txt` files. """ -load("//python/private:normalize_name.bzl", "normalize_name") -load("//python/private/pypi:multi_pip_parse.bzl", _multi_pip_parse = "multi_pip_parse") -load("//python/private/pypi:package_annotation.bzl", _package_annotation = "package_annotation") load("//python/private/pypi:pip_compile.bzl", "pip_compile") -load("//python/private/pypi:pip_repository.bzl", "pip_repository") -load("//python/private/pypi:whl_library_alias.bzl", _whl_library_alias = "whl_library_alias") load("//python/private/whl_filegroup:whl_filegroup.bzl", _whl_filegroup = "whl_filegroup") compile_pip_requirements = pip_compile -package_annotation = _package_annotation -pip_parse = pip_repository whl_filegroup = _whl_filegroup - -# Extra utilities visible to rules_python users. -pip_utils = struct( - normalize_name = normalize_name, -) - -# The following are only exported here because they are used from -# multi_toolchain_aliases repository_rule, not intended for public use. -# -# See ./private/toolchains_repo.bzl -multi_pip_parse = _multi_pip_parse -whl_library_alias = _whl_library_alias diff --git a/python/pip_install/BUILD.bazel b/python/pip_install/BUILD.bazel index 665375cc5b..af587588c9 100644 --- a/python/pip_install/BUILD.bazel +++ b/python/pip_install/BUILD.bazel @@ -18,17 +18,6 @@ package( default_visibility = ["//:__subpackages__"], ) -bzl_library( - name = "pip_repository_bzl", - srcs = ["pip_repository.bzl"], - deps = [ - "//python/private/pypi:package_annotation_bzl", - "//python/private/pypi:pip_repository_bzl", - "//python/private/pypi:whl_config_repo_bzl", - "//python/private/pypi:whl_library_bzl", - ], -) - bzl_library( name = "requirements_bzl", srcs = ["requirements.bzl"], diff --git a/python/pip_install/pip_repository.bzl b/python/pip_install/pip_repository.bzl deleted file mode 100644 index f9c3c9fb56..0000000000 --- a/python/pip_install/pip_repository.bzl +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright 2023 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"" - -load("//python/private/pypi:package_annotation.bzl", _package_annotation = "package_annotation") -load("//python/private/pypi:pip_repository.bzl", _pip_repository = "pip_repository") -load("//python/private/pypi:whl_config_repo.bzl", _whl_config_repo = "whl_config_repo") -load("//python/private/pypi:whl_library.bzl", _whl_library = "whl_library") - -# Re-exports for backwards compatibility -group_library = _whl_config_repo -pip_repository = _pip_repository -whl_library = _whl_library -whl_config_repo = _whl_config_repo -package_annotation = _package_annotation diff --git a/python/private/get_local_runtime_info.py b/python/private/get_local_runtime_info.py index a59e17a012..787fad5635 100644 --- a/python/private/get_local_runtime_info.py +++ b/python/private/get_local_runtime_info.py @@ -48,9 +48,7 @@ def _search_directories(get_config, base_executable) -> list[str]: # On MacOS, the LDLIBRARY may be a relative path under /Library/Frameworks, # such as "Python.framework/Versions/3.12/Python", not a file under the # LIBDIR/LIBPL directory, so include PYTHONFRAMEWORKPREFIX. - lib_dirs = [ - get_config(x) for x in ("PYTHONFRAMEWORKPREFIX", "LIBPL", "LIBDIR") - ] + lib_dirs = [get_config(x) for x in ("PYTHONFRAMEWORKPREFIX", "LIBPL", "LIBDIR")] # On Debian, with multiarch enabled, prior to Python 3.10, `LIBDIR` didn't # tell the location of the libs, just the base directory. The `MULTIARCH` @@ -67,8 +65,8 @@ def _search_directories(get_config, base_executable) -> list[str]: if not _IS_DARWIN: for exec_dir in ( - os.path.dirname(base_executable) if base_executable else None, - get_config("BINDIR"), + os.path.dirname(base_executable) if base_executable else None, + get_config("BINDIR"), ): if not exec_dir: continue @@ -122,7 +120,8 @@ def _search_library_names(get_config, version, abi_flags) -> list[str]: # # A typical LIBRARY is 'libpythonX.Y.a' on Linux. lib_names = [ - get_config(x) for x in ( + get_config(x) + for x in ( "LDLIBRARY", "INSTSONAME", "PY3LIBRARY", @@ -167,8 +166,7 @@ def _get_python_library_info(base_executable) -> dict[str, Any]: abi_flags = _get_abi_flags(config_vars.get) search_directories = _search_directories(config_vars.get, base_executable) - search_libnames = _search_library_names(config_vars.get, version, - abi_flags) + search_libnames = _search_library_names(config_vars.get, version, abi_flags) # Used to test whether the library is an abi3 library or a full api library. abi3_libraries = _default_library_names(sys.version_info.major, abi_flags) @@ -221,10 +219,10 @@ def _get_python_library_info(base_executable) -> dict[str, Any]: # Additional DLLs are needed on Windows to link properly. dlls = [] if _IS_WINDOWS: - dlls.extend( - glob.glob(os.path.join(os.path.dirname(base_executable), "*.dll"))) + dlls.extend(glob.glob(os.path.join(os.path.dirname(base_executable), "*.dll"))) dlls = [ - x for x in dlls + x + for x in dlls if x not in dynamic_libraries and x not in abi_dynamic_libraries ] diff --git a/python/private/pypi/BUILD.bazel b/python/private/pypi/BUILD.bazel index 2a62767dd4..34e0def2c9 100644 --- a/python/private/pypi/BUILD.bazel +++ b/python/private/pypi/BUILD.bazel @@ -226,20 +226,6 @@ bzl_library( srcs = ["labels.bzl"], ) -bzl_library( - name = "multi_pip_parse_bzl", - srcs = ["multi_pip_parse.bzl"], - deps = [ - ":pip_repository_bzl", - "//python/private:text_util_bzl", - ], -) - -bzl_library( - name = "package_annotation_bzl", - srcs = ["package_annotation.bzl"], -) - bzl_library( name = "parse_requirements_bzl", srcs = ["parse_requirements.bzl"], @@ -339,25 +325,6 @@ bzl_library( ], ) -bzl_library( - name = "pip_repository_bzl", - srcs = ["pip_repository.bzl"], - deps = [ - ":attrs_bzl", - ":evaluate_markers_bzl", - ":parse_requirements_bzl", - ":pep508_env_bzl", - ":pip_repository_attrs_bzl", - ":pypi_repo_utils_bzl", - ":render_pkg_aliases_bzl", - ":whl_config_setting_bzl", - "//python/private:normalize_name_bzl", - "//python/private:repo_utils_bzl", - "//python/private:text_util_bzl", - "@bazel_skylib//lib:sets", - ], -) - bzl_library( name = "pip_repository_attrs_bzl", srcs = ["pip_repository_attrs.bzl"], @@ -461,15 +428,6 @@ bzl_library( srcs = ["version_from_filename.bzl"], ) -bzl_library( - name = "whl_config_repo_bzl", - srcs = ["whl_config_repo.bzl"], - deps = [ - ":generate_group_library_build_bazel_bzl", - "//python/private:text_util_bzl", - ], -) - bzl_library( name = "whl_config_setting_bzl", srcs = ["whl_config_setting.bzl"], @@ -485,15 +443,6 @@ bzl_library( ], ) -bzl_library( - name = "whl_library_alias_bzl", - srcs = ["whl_library_alias.bzl"], - deps = [ - ":render_pkg_aliases_bzl", - "//python/private:full_version_bzl", - ], -) - bzl_library( name = "whl_library_bzl", srcs = ["whl_library.bzl"], diff --git a/python/private/pypi/dependency_resolver/dependency_resolver.py b/python/private/pypi/dependency_resolver/dependency_resolver.py index f3a339f929..34f2fb1e5a 100644 --- a/python/private/pypi/dependency_resolver/dependency_resolver.py +++ b/python/private/pypi/dependency_resolver/dependency_resolver.py @@ -159,7 +159,9 @@ def main( # Further, shutil.copy preserves the source file's mode, and so if # our source file is read-only (the default under Perforce Helix), # this scratch file will also be read-only, defeating its purpose. - with open(resolved_requirements_file, "rb") as fsrc, open(requirements_out, "wb") as fdst: + with open(resolved_requirements_file, "rb") as fsrc, open( + requirements_out, "wb" + ) as fdst: shutil.copyfileobj(fsrc, fdst) update_command = ( diff --git a/python/private/pypi/multi_pip_parse.bzl b/python/private/pypi/multi_pip_parse.bzl deleted file mode 100644 index 60496c2eca..0000000000 --- a/python/private/pypi/multi_pip_parse.bzl +++ /dev/null @@ -1,166 +0,0 @@ -# Copyright 2024 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""A pip_parse implementation for version aware toolchains in WORKSPACE.""" - -load("//python/private:text_util.bzl", "render") -load(":pip_repository.bzl", pip_parse = "pip_repository") - -def _multi_pip_parse_impl(rctx): - rules_python = rctx.attr._rules_python_workspace.repo_name - load_statements = [] - install_deps_calls = [] - process_requirements_calls = [] - for python_version, pypi_repository in rctx.attr.pip_parses.items(): - sanitized_python_version = python_version.replace(".", "_") - load_statement = """\ -load( - "@{pypi_repository}//:requirements.bzl", - _{sanitized_python_version}_install_deps = "install_deps", - _{sanitized_python_version}_all_requirements = "all_requirements", -)""".format( - pypi_repository = pypi_repository, - sanitized_python_version = sanitized_python_version, - ) - load_statements.append(load_statement) - process_requirements_call = """\ -_process_requirements( - pkg_labels = _{sanitized_python_version}_all_requirements, - python_version = "{python_version}", - repo_prefix = "{pypi_repository}_", -)""".format( - pypi_repository = pypi_repository, - python_version = python_version, - sanitized_python_version = sanitized_python_version, - ) - process_requirements_calls.append(process_requirements_call) - install_deps_call = """ _{sanitized_python_version}_install_deps(**whl_library_kwargs)""".format( - sanitized_python_version = sanitized_python_version, - ) - install_deps_calls.append(install_deps_call) - - # NOTE @aignas 2023-10-31: I am not sure it is possible to render aliases - # for all of the packages using the `render_pkg_aliases` function because - # we need to know what the list of packages for each version is and then - # we would be creating directories for each. - macro_tmpl = "@%s_{}//:{}" % rctx.attr.name - - requirements_bzl = """\ -# Generated by python/pip.bzl - -load("@{rules_python}//python:pip.bzl", "whl_library_alias", "pip_utils") -{load_statements} - -_wheel_names = [] -_version_map = dict() -def _process_requirements(pkg_labels, python_version, repo_prefix): - for pkg_label in pkg_labels: - wheel_name = Label(pkg_label).package - if not wheel_name: - # We are dealing with the cases where we don't have aliases. - workspace_name = Label(pkg_label).repo_name - wheel_name = workspace_name[len(repo_prefix):] - - _wheel_names.append(wheel_name) - if not wheel_name in _version_map: - _version_map[wheel_name] = dict() - _version_map[wheel_name][python_version] = repo_prefix - -{process_requirements_calls} - -def requirement(name): - return "{macro_tmpl}".format(pip_utils.normalize_name(name), "pkg") - -def whl_requirement(name): - return "{macro_tmpl}".format(pip_utils.normalize_name(name), "whl") - -def data_requirement(name): - return "{macro_tmpl}".format(pip_utils.normalize_name(name), "data") - -def dist_info_requirement(name): - return "{macro_tmpl}".format(pip_utils.normalize_name(name), "dist_info") - -def install_deps(**whl_library_kwargs): -{install_deps_calls} - for wheel_name in _wheel_names: - whl_library_alias( - name = "{name}_" + wheel_name, - wheel_name = wheel_name, - default_version = "{default_version}", - minor_mapping = {minor_mapping}, - version_map = _version_map[wheel_name], - ) -""".format( - name = rctx.attr.name, - install_deps_calls = "\n".join(install_deps_calls), - load_statements = "\n".join(load_statements), - macro_tmpl = macro_tmpl, - process_requirements_calls = "\n".join(process_requirements_calls), - rules_python = rules_python, - default_version = rctx.attr.default_version, - minor_mapping = render.indent(render.dict(rctx.attr.minor_mapping)).lstrip(), - ) - rctx.file("requirements.bzl", requirements_bzl) - rctx.file("BUILD.bazel", "exports_files(['requirements.bzl'])") - -_multi_pip_parse = repository_rule( - _multi_pip_parse_impl, - attrs = { - "default_version": attr.string(), - "minor_mapping": attr.string_dict(), - "pip_parses": attr.string_dict(), - "_rules_python_workspace": attr.label(default = Label("//:WORKSPACE")), - }, -) - -def multi_pip_parse(name, default_version, python_versions, python_interpreter_target, requirements_lock, minor_mapping, **kwargs): - """NOT INTENDED FOR DIRECT USE! - - This is intended to be used by the multi_pip_parse implementation in the template of the - multi_toolchain_aliases repository rule. - - Args: - name: the name of the multi_pip_parse repository. - default_version: {type}`str` the default Python version. - python_versions: {type}`list[str]` all Python toolchain versions currently registered. - python_interpreter_target: {type}`dict[str, Label]` a dictionary which keys are Python versions and values are resolved host interpreters. - requirements_lock: {type}`dict[str, Label]` a dictionary which keys are Python versions and values are locked requirements files. - minor_mapping: {type}`dict[str, str]` mapping between `X.Y` to `X.Y.Z` format. - **kwargs: extra arguments passed to all wrapped pip_parse. - - Returns: - The internal implementation of multi_pip_parse repository rule. - """ - pip_parses = {} - for python_version in python_versions: - if not python_version in python_interpreter_target: - fail("Missing python_interpreter_target for Python version %s in '%s'" % (python_version, name)) - if not python_version in requirements_lock: - fail("Missing requirements_lock for Python version %s in '%s'" % (python_version, name)) - - pip_parse_name = name + "_" + python_version.replace(".", "_") - pip_parse( - name = pip_parse_name, - python_interpreter_target = python_interpreter_target[python_version], - requirements_lock = requirements_lock[python_version], - **kwargs - ) - pip_parses[python_version] = pip_parse_name - - return _multi_pip_parse( - name = name, - default_version = default_version, - pip_parses = pip_parses, - minor_mapping = minor_mapping, - ) diff --git a/python/private/pypi/package_annotation.bzl b/python/private/pypi/package_annotation.bzl deleted file mode 100644 index 4a54703ac4..0000000000 --- a/python/private/pypi/package_annotation.bzl +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright 2024 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Package annotation API for WORKSPACE setups.""" - -def package_annotation( - additive_build_content = None, - copy_files = {}, - copy_executables = {}, - data = [], - data_exclude_glob = [], - srcs_exclude_glob = []): - """Annotations to apply to the BUILD file content from package generated from a `pip_repository` rule. - - [cf]: https://github.com/bazelbuild/bazel-skylib/blob/main/docs/copy_file_doc.md - - Args: - additive_build_content (str, optional): Raw text to add to the generated `BUILD` file of a package. - copy_files (dict, optional): A mapping of `src` and `out` files for [@bazel_skylib//rules:copy_file.bzl][cf] - copy_executables (dict, optional): A mapping of `src` and `out` files for - [@bazel_skylib//rules:copy_file.bzl][cf]. Targets generated here will also be flagged as - executable. - data (list, optional): A list of labels to add as `data` dependencies to the generated `py_library` target. - data_exclude_glob (list, optional): A list of exclude glob patterns to add as `data` to the generated - `py_library` target. - srcs_exclude_glob (list, optional): A list of labels to add as `srcs` to the generated `py_library` target. - - Returns: - str: A json encoded string of the provided content. - """ - return json.encode(struct( - additive_build_content = additive_build_content, - copy_files = copy_files, - copy_executables = copy_executables, - data = data, - data_exclude_glob = data_exclude_glob, - srcs_exclude_glob = srcs_exclude_glob, - )) diff --git a/python/private/pypi/parse_requirements.bzl b/python/private/pypi/parse_requirements.bzl index 07d0c0989e..d33d7dd757 100644 --- a/python/private/pypi/parse_requirements.bzl +++ b/python/private/pypi/parse_requirements.bzl @@ -27,7 +27,6 @@ behavior. """ load("//python/private:normalize_name.bzl", "normalize_name") -load("//python/private:repo_utils.bzl", "repo_utils") load(":argparse.bzl", "argparse") load(":index_sources.bzl", "index_sources") load(":parse_requirements_txt.bzl", "parse_requirements_txt") @@ -336,56 +335,6 @@ def _package_srcs( return srcs.values() -def select_requirement(requirements, *, platform): - """A simple function to get a requirement for a particular platform. - - Only used in WORKSPACE. - - Args: - requirements (list[struct]): The list of requirements as returned by - the `parse_requirements` function above. - platform (str or None): The host platform. Usually an output of the - `host_platform` function. If None, then this function will return - the first requirement it finds. - - Returns: - None if not found or a struct returned as one of the values in the - parse_requirements function. The requirement that should be downloaded - by the host platform will be returned. - """ - maybe_requirement = [ - req - for req in requirements - if not platform or [p for p in req.target_platforms if p.endswith(platform)] - ] - if not maybe_requirement: - # Sometimes the package is not present for host platform if there - # are whls specified only in particular requirements files, in that - # case just continue, however, if the download_only flag is set up, - # then the user can also specify the target platform of the wheel - # packages they want to download, in that case there will be always - # a requirement here, so we will not be in this code branch. - return None - - return maybe_requirement[0] - -def host_platform(ctx): - """Return a string representation of the repository OS. - - Only used in WORKSPACE. - - Args: - ctx (struct): The `module_ctx` or `repository_ctx` attribute. - - Returns: - The string representation of the platform that we can later used in the `pip` - machinery. - """ - return "{}_{}".format( - repo_utils.get_platforms_os_name(ctx), - repo_utils.get_platforms_cpu_name(ctx), - ) - def _add_dists(*, requirement, index_urls, target_platform, logger = None): """Populate dists based on the information from the PyPI index. diff --git a/python/private/pypi/pip_repository.bzl b/python/private/pypi/pip_repository.bzl deleted file mode 100644 index 4afb62780a..0000000000 --- a/python/private/pypi/pip_repository.bzl +++ /dev/null @@ -1,381 +0,0 @@ -# Copyright 2023 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"" - -load("@bazel_skylib//lib:sets.bzl", "sets") -load("//python/private:normalize_name.bzl", "normalize_name") -load("//python/private:repo_utils.bzl", "REPO_DEBUG_ENV_VAR", "repo_utils") -load("//python/private:text_util.bzl", "render") -load(":evaluate_markers.bzl", "evaluate_markers") -load(":parse_requirements.bzl", "host_platform", "parse_requirements", "select_requirement") -load(":pep508_env.bzl", "env") -load(":pip_repository_attrs.bzl", "ATTRS") -load(":pypi_repo_utils.bzl", "pypi_repo_utils") -load(":render_pkg_aliases.bzl", "render_pkg_aliases") -load(":requirements_files_by_platform.bzl", "requirements_files_by_platform") - -_CONFIG_REPO_TEMPLATE = """"{name}__config" - whl_config_repo( - name = "{name}__config", - repo_prefix = "{name}_", - groups = all_requirement_groups, - whl_map = {{ - p: "" - for p in all_whl_requirements_by_package - }}, - )""" - -def _get_python_interpreter_attr(rctx): - """A helper function for getting the `python_interpreter` attribute or it's default - - Args: - rctx (repository_ctx): Handle to the rule repository context. - - Returns: - str: The attribute value or it's default - """ - if rctx.attr.python_interpreter: - return rctx.attr.python_interpreter - - if "win" in rctx.os.name: - return "python.exe" - else: - return "python3" - -def use_isolated(ctx, attr): - """Determine whether or not to pass the pip `--isolated` flag to the pip invocation. - - Args: - ctx: repository or module context - attr: attributes for the repo rule or tag extension - - Returns: - True if --isolated should be passed - """ - use_isolated = attr.isolated - - # The environment variable will take precedence over the attribute - isolated_env = ctx.getenv("RULES_PYTHON_PIP_ISOLATED", None) - if isolated_env != None: - if isolated_env.lower() in ("0", "false"): - use_isolated = False - else: - use_isolated = True - - return use_isolated - -_BUILD_FILE_CONTENTS = """\ -package(default_visibility = ["//visibility:public"]) - -# Ensure the `requirements.bzl` source can be accessed by stardoc, since users load() from it -exports_files(["requirements.bzl"]) -""" - -def _pip_repository_impl(rctx): - logger = repo_utils.logger(rctx) - python_interpreter = pypi_repo_utils.resolve_python_interpreter( - rctx, - python_interpreter = rctx.attr.python_interpreter, - python_interpreter_target = rctx.attr.python_interpreter_target, - ) - result = pypi_repo_utils.execute_checked( - rctx, - python = python_interpreter, - srcs = [], - op = "GetPythonVersion", - arguments = ["-c", "import sys; print(sys.version.split()[0])"], - ) - python_version = result.stdout.strip().splitlines()[-1] - platforms = [ - "linux_aarch64", - "linux_arm", - "linux_ppc", - "linux_riscv64", - "linux_s390x", - "linux_x86_64", - "osx_aarch64", - "osx_x86_64", - "windows_x86_64", - ] - - marker_env = env(os = rctx.os.name, arch = rctx.os.arch, python_version = python_version) - requirements_by_platform = parse_requirements( - rctx, - requirements_by_platform = requirements_files_by_platform( - requirements_by_platform = rctx.attr.requirements_by_platform, - requirements_linux = rctx.attr.requirements_linux, - requirements_lock = rctx.attr.requirements_lock, - requirements_osx = rctx.attr.requirements_darwin, - requirements_windows = rctx.attr.requirements_windows, - extra_pip_args = rctx.attr.extra_pip_args, - platforms = platforms, - ), - extra_pip_args = rctx.attr.extra_pip_args, - evaluate_markers = lambda requirements: evaluate_markers( - requirements = { - # NOTE @aignas 2025-07-07: because we don't distinguish between - # freethreaded and non-freethreaded, it is a 1:1 mapping. - req: {p: p for p in plats} - for req, plats in requirements.items() - }, - platforms = {p: struct(env = marker_env) for p in platforms}, - ), - extract_url_srcs = False, - logger = logger, - ) - selected_requirements = {} - options = None - repository_platform = host_platform(rctx) - for whl in requirements_by_platform: - requirement = select_requirement( - whl.srcs, - platform = None if rctx.attr.download_only else repository_platform, - ) - if not requirement: - continue - options = options or requirement.extra_pip_args - selected_requirements[whl.name] = requirement.requirement_line - - bzl_packages = sorted(selected_requirements.keys()) - - # Normalize cycles first - requirement_cycles = { - name: sorted(sets.to_list(sets.make(deps))) - for name, deps in rctx.attr.experimental_requirement_cycles.items() - } - - # Check for conflicts between cycles _before_ we normalize package names so - # that reported errors use the names the user specified - for i in range(len(requirement_cycles)): - left_group = requirement_cycles.keys()[i] - left_deps = requirement_cycles.values()[i] - for j in range(len(requirement_cycles) - (i + 1)): - right_deps = requirement_cycles.values()[1 + i + j] - right_group = requirement_cycles.keys()[1 + i + j] - for d in left_deps: - if d in right_deps: - fail("Error: Requirement %s cannot be repeated between cycles %s and %s; please merge the cycles." % (d, left_group, right_group)) - - # And normalize the names as used in the cycle specs - # - # NOTE: We must check that a listed dependency is actually in the actual - # requirements set for the current platform so that we can support cycles in - # platform-conditional requirements. Otherwise we'll blindly generate a - # label referencing a package which may not be installed on the current - # platform. - requirement_cycles = { - normalize_name(name): sorted([normalize_name(d) for d in group if normalize_name(d) in bzl_packages]) - for name, group in requirement_cycles.items() - } - - imports = [ - # NOTE: Maintain the order consistent with `buildifier` - 'load("@rules_python//python:pip.bzl", "pip_utils")', - 'load("@rules_python//python/pip_install:pip_repository.bzl", "whl_config_repo", "whl_library")', - ] - - annotations = {} - for pkg, annotation in rctx.attr.annotations.items(): - filename = "{}.annotation.json".format(normalize_name(pkg)) - rctx.file(filename, json.encode_indent(json.decode(annotation))) - annotations[pkg] = "@{name}//:{filename}".format(name = rctx.attr.name, filename = filename) - - config = { - "download_only": rctx.attr.download_only, - "enable_implicit_namespace_pkgs": rctx.attr.enable_implicit_namespace_pkgs, - "environment": rctx.attr.environment, - "envsubst": rctx.attr.envsubst, - "extra_pip_args": options, - "isolated": use_isolated(rctx, rctx.attr), - "pip_data_exclude": rctx.attr.pip_data_exclude, - "python_interpreter": _get_python_interpreter_attr(rctx), - "quiet": rctx.attr.quiet, - "repo": rctx.attr.name, - "timeout": rctx.attr.timeout, - } - if rctx.attr.use_hub_alias_dependencies: - config["dep_template"] = "@{}//{{name}}:{{target}}".format(rctx.attr.name) - else: - config["repo_prefix"] = "{}_".format(rctx.attr.name) - - if rctx.attr.python_interpreter_target: - config["python_interpreter_target"] = str(rctx.attr.python_interpreter_target) - - macro_tmpl = "@%s//{}:{}" % rctx.attr.name - - aliases = render_pkg_aliases( - aliases = { - pkg: rctx.attr.name + "_" + pkg - for pkg in bzl_packages - }, - extra_hub_aliases = rctx.attr.extra_hub_aliases, - requirement_cycles = requirement_cycles, - ) - for path, contents in aliases.items(): - rctx.file(path, contents) - - rctx.file("BUILD.bazel", _BUILD_FILE_CONTENTS) - if rctx.attr.use_hub_alias_dependencies: - rctx.template( - "config.bzl", - rctx.attr._config_template, - substitutions = { - "%%PACKAGES%%": render.dict({ - pkg: None - for pkg in bzl_packages - }, value_repr = lambda x: "None"), - }, - ) - config_repo_template = repr(rctx.attr.name) - else: - config_repo_template = _CONFIG_REPO_TEMPLATE.format(name = rctx.attr.name) - - rctx.template("requirements.bzl", rctx.attr._template, substitutions = { - "%%ALL_DATA_REQUIREMENTS%%": render.list([ - macro_tmpl.format(p, "data") - for p in bzl_packages - ]), - "%%ALL_REQUIREMENTS%%": render.list([ - macro_tmpl.format(p, "pkg") - for p in bzl_packages - ]), - "%%ALL_REQUIREMENT_GROUPS%%": render.dict(requirement_cycles), - "%%ALL_WHL_REQUIREMENTS_BY_PACKAGE%%": render.dict({ - p: macro_tmpl.format(p, "whl") - for p in bzl_packages - }), - "%%ANNOTATIONS%%": render.dict(dict(sorted(annotations.items()))), - "%%CONFIG%%": render.dict(dict(sorted(config.items()))), - "%%CONFIG_REPO%%": config_repo_template, - "%%EXTRA_PIP_ARGS%%": json.encode(options), - "%%IMPORTS%%": "\n".join(imports), - "%%MACRO_TMPL%%": macro_tmpl, - "%%NAME%%": rctx.attr.name, - "%%PACKAGES%%": render.list( - [ - ("{}_{}".format(rctx.attr.name, p), r) - for p, r in sorted(selected_requirements.items()) - ], - ), - }) - - return - -pip_repository = repository_rule( - attrs = dict( - annotations = attr.string_dict( - doc = """\ -Optional annotations to apply to packages. Keys should be package names, with -capitalization matching the input requirements file, and values should be -generated using the `package_name` macro. -""", - ), - _config_template = attr.label( - default = ":config.bzl.tmpl", - ), - _template = attr.label( - default = ":requirements.bzl.tmpl.workspace", - ), - **ATTRS - ), - doc = """Accepts a locked/compiled requirements file and installs the dependencies listed within. - -Those dependencies become available in a generated `requirements.bzl` file. -You can instead check this `requirements.bzl` file into your repo, see the "vendoring" section below. - -For advanced use-cases, such as handling multi-platform dependencies, see the -[How-to: Multi-Platform PyPI Dependencies guide](/howto/multi-platform-pypi-deps). - -In your WORKSPACE file: - -```starlark -load("@rules_python//python:pip.bzl", "pip_parse") - -pip_parse( - name = "pypi", - requirements_lock = ":requirements.txt", -) - -load("@pypi//:requirements.bzl", "install_deps") - -install_deps() -``` - -You can then reference installed dependencies from a `BUILD` file with the alias targets generated in the same repo, for example, for `PyYAML` we would have the following: -- `@pypi//pyyaml` and `@pypi//pyyaml:pkg` both point to the `py_library` - created after extracting the `PyYAML` package. -- `@pypi//pyyaml:data` points to the extra data included in the package. -- `@pypi//pyyaml:dist_info` points to the `dist-info` files in the package. -- `@pypi//pyyaml:whl` points to the wheel file that was extracted. - -```starlark -py_library( - name = "bar", - ... - deps = [ - "//my/other:dep", - "@pypi//numpy", - "@pypi//requests", - ], -) -``` - -or - -```starlark -load("@pypi//:requirements.bzl", "requirement") - -py_library( - name = "bar", - ... - deps = [ - "//my/other:dep", - requirement("numpy"), - requirement("requests"), - ], -) -``` - -In addition to the `requirement` macro, which is used to access the generated `py_library` -target generated from a package's wheel, The generated `requirements.bzl` file contains -functionality for exposing [entry points][whl_ep] as `py_binary` targets as well. - -[whl_ep]: https://packaging.python.org/specifications/entry-points/ - -:::{rubric} Vendoring the requirements.bzl file -:heading-level: 3 -::: - -In some cases you may not want to generate the requirements.bzl file as a repository rule -while Bazel is fetching dependencies. For example, if you produce a reusable Bazel module -such as a ruleset, you may want to include the requirements.bzl file rather than make your users -install the WORKSPACE setup to generate it. -See https://github.com/bazel-contrib/rules_python/issues/608 - -This is the same workflow as Gazelle, which creates `go_repository` rules with -[`update-repos`](https://github.com/bazelbuild/bazel-gazelle#update-repos) - -To do this, use the "write to source file" pattern documented in -https://blog.aspect.dev/bazel-can-write-to-the-source-folder -to put a copy of the generated requirements.bzl into your project. -Then load the requirements.bzl file directly rather than from the generated repository. -See the example in rules_python/examples/pip_parse_vendored. -""", - implementation = _pip_repository_impl, - environ = [ - "RULES_PYTHON_PIP_ISOLATED", - REPO_DEBUG_ENV_VAR, - ], -) diff --git a/python/private/pypi/requirements.bzl.tmpl.workspace b/python/private/pypi/requirements.bzl.tmpl.workspace deleted file mode 100644 index f61a5271f6..0000000000 --- a/python/private/pypi/requirements.bzl.tmpl.workspace +++ /dev/null @@ -1,74 +0,0 @@ -"""Starlark representation of locked requirements. - -@generated by rules_python pip_parse repository rule. -""" - -%%IMPORTS%% - -all_requirements = %%ALL_REQUIREMENTS%% - -all_whl_requirements_by_package = %%ALL_WHL_REQUIREMENTS_BY_PACKAGE%% - -all_whl_requirements = all_whl_requirements_by_package.values() - -all_data_requirements = %%ALL_DATA_REQUIREMENTS%% - -_packages = %%PACKAGES%% -_config = %%CONFIG%% -_annotations = %%ANNOTATIONS%% - -def requirement(name): - return "%%MACRO_TMPL%%".format(pip_utils.normalize_name(name), "pkg") - -def whl_requirement(name): - return "%%MACRO_TMPL%%".format(pip_utils.normalize_name(name), "whl") - -def data_requirement(name): - return "%%MACRO_TMPL%%".format(pip_utils.normalize_name(name), "data") - -def dist_info_requirement(name): - return "%%MACRO_TMPL%%".format(pip_utils.normalize_name(name), "dist_info") - -def _get_annotation(requirement): - # This expects to parse `setuptools==58.2.0 --hash=sha256:2551203ae6955b9876741a26ab3e767bb3242dafe86a32a749ea0d78b6792f11` - # down to `setuptools`. - name = requirement.split(" ")[0].split("=")[0].split("[")[0] - return _annotations.get(name) - -def install_deps(**whl_library_kwargs): - """Repository rule macro. Install dependencies from `pip_parse`. - - Args: - **whl_library_kwargs: Additional arguments which will flow to underlying - `whl_library` calls. See pip_repository.bzl for details. - """ - - # Set up the requirement groups - all_requirement_groups = %%ALL_REQUIREMENT_GROUPS%% - - requirement_group_mapping = { - requirement: group_name - for group_name, group_requirements in all_requirement_groups.items() - for requirement in group_requirements - } - - config_repo = %%CONFIG_REPO%% - config_load = "@{}//:config.bzl".format(config_repo) - - # Install wheels which may be participants in a group - whl_config = dict(_config) - whl_config.update(whl_library_kwargs) - - for name, requirement in _packages: - group_name = requirement_group_mapping.get(name.replace("%%NAME%%_", "")) - group_deps = all_requirement_groups.get(group_name, []) - - whl_library( - name = name, - requirement = requirement, - group_name = group_name, - group_deps = group_deps, - annotation = _get_annotation(requirement), - config_load = config_load, - **whl_config - ) diff --git a/python/private/pypi/whl_config_repo.bzl b/python/private/pypi/whl_config_repo.bzl deleted file mode 100644 index b7cea5a8b7..0000000000 --- a/python/private/pypi/whl_config_repo.bzl +++ /dev/null @@ -1,46 +0,0 @@ -"""whl_config_library implementation for WORKSPACE setups.""" - -load("//python/private:text_util.bzl", "render") -load(":generate_group_library_build_bazel.bzl", "generate_group_library_build_bazel") - -def _whl_config_repo_impl(rctx): - build_file_contents = generate_group_library_build_bazel( - repo_prefix = rctx.attr.repo_prefix, - groups = rctx.attr.groups, - ) - rctx.file("_groups/BUILD.bazel", build_file_contents) - rctx.file("BUILD.bazel", "") - rctx.template( - "config.bzl", - rctx.attr._config_template, - substitutions = { - "%%PACKAGES%%": render.dict(rctx.attr.whl_map or {}, value_repr = lambda x: "None"), - }, - ) - -whl_config_repo = repository_rule( - attrs = { - "groups": attr.string_list_dict( - doc = "A mapping of group names to requirements within that group.", - ), - "repo_prefix": attr.string( - doc = "Prefix used for the whl_library created components of each group", - ), - "whl_map": attr.string_dict( - doc = """\ -The wheel map where values are json.encoded strings of the whl_map constructed -in the pip.parse tag class. -""", - ), - "_config_template": attr.label( - default = ":config.bzl.tmpl", - ), - }, - doc = """ -Create a package containing only wrapper py_library and whl_library rules for implementing dependency groups. -This is an implementation detail of dependency groups and should not be used alone. - -PRIVATE USE ONLY, only used in WORKSPACE. - """, - implementation = _whl_config_repo_impl, -) diff --git a/python/private/pypi/whl_library_alias.bzl b/python/private/pypi/whl_library_alias.bzl deleted file mode 100644 index 66c3504d90..0000000000 --- a/python/private/pypi/whl_library_alias.bzl +++ /dev/null @@ -1,103 +0,0 @@ -# Copyright 2024 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""whl_library aliases for multi_pip_parse.""" - -load("//python/private:full_version.bzl", "full_version") -load(":render_pkg_aliases.bzl", "NO_MATCH_ERROR_MESSAGE_TEMPLATE") - -def _whl_library_alias_impl(rctx): - rules_python = rctx.attr._rules_python_workspace.repo_name - if rctx.attr.default_version: - default_repo_prefix = rctx.attr.version_map[rctx.attr.default_version] - else: - default_repo_prefix = None - version_map = rctx.attr.version_map.items() - build_content = ["# Generated by python/pip.bzl"] - for alias_name in ["pkg", "whl", "data", "dist_info"]: - build_content.append(_whl_library_render_alias_target( - alias_name = alias_name, - default_repo_prefix = default_repo_prefix, - minor_mapping = rctx.attr.minor_mapping, - rules_python = rules_python, - version_map = version_map, - wheel_name = rctx.attr.wheel_name, - )) - rctx.file("BUILD.bazel", "\n".join(build_content)) - -def _whl_library_render_alias_target( - *, - alias_name, - default_repo_prefix, - minor_mapping, - rules_python, - version_map, - wheel_name): - alias = ["""\ -alias( - name = "{alias_name}", - actual = select({{""".format(alias_name = alias_name)] - for [python_version, repo_prefix] in version_map: - alias.append("""\ - "@{rules_python}//python/config_settings:is_python_{full_python_version}": "{actual}",""".format( - full_python_version = full_version(version = python_version, minor_mapping = minor_mapping), - actual = "@{repo_prefix}{wheel_name}//:{alias_name}".format( - repo_prefix = repo_prefix, - wheel_name = wheel_name, - alias_name = alias_name, - ), - rules_python = rules_python, - )) - if default_repo_prefix: - default_actual = "@{repo_prefix}{wheel_name}//:{alias_name}".format( - repo_prefix = default_repo_prefix, - wheel_name = wheel_name, - alias_name = alias_name, - ) - alias.append(' "//conditions:default": "{default_actual}",'.format( - default_actual = default_actual, - )) - - alias.append(" },") # Close select expression condition dict - if not default_repo_prefix: - supported_versions = sorted([python_version for python_version, _ in version_map]) - alias.append(' no_match_error="""{}""",'.format( - NO_MATCH_ERROR_MESSAGE_TEMPLATE.format( - supported_versions = ", ".join(supported_versions), - rules_python = rules_python, - ), - )) - alias.append(" ),") # Close the select expression - alias.append(' visibility = ["//visibility:public"],') - alias.append(")") # Close the alias() expression - return "\n".join(alias) - -whl_library_alias = repository_rule( - _whl_library_alias_impl, - attrs = { - "default_version": attr.string( - mandatory = False, - doc = "Optional Python version in major.minor format, e.g. '3.10'." + - "The Python version of the wheel to use when the versions " + - "from `version_map` don't match. This allows the default " + - "(version unaware) rules to match and select a wheel. If " + - "not specified, then the default rules won't be able to " + - "resolve a wheel and an error will occur.", - ), - "minor_mapping": attr.string_dict(mandatory = True), - "version_map": attr.string_dict(mandatory = True), - "wheel_name": attr.string(mandatory = True), - "_rules_python_workspace": attr.label(default = Label("//:WORKSPACE")), - }, -) diff --git a/sphinxdocs/sphinxdocs/private/sphinx_build.py b/sphinxdocs/sphinxdocs/private/sphinx_build.py index b438c89fe1..56ff37ed0f 100644 --- a/sphinxdocs/sphinxdocs/private/sphinx_build.py +++ b/sphinxdocs/sphinxdocs/private/sphinx_build.py @@ -83,8 +83,11 @@ def run(self) -> None: if response: self._send_response(response) except SphinxMainError as e: - logger.error("Sphinx main returned failure: exit_code=%s request=%s", - request, e.exit_code) + logger.error( + "Sphinx main returned failure: exit_code=%s request=%s", + request, + e.exit_code, + ) request_id = 0 if not request else request.get("requestId", 0) self._send_response( { @@ -218,7 +221,6 @@ def _process_request(self, request: "WorkRequest") -> "WorkResponse | None": ) raise SphinxMainError(message, exit_code) - # Copying is unfortunately necessary because Bazel doesn't know to # implicily bring along what the symlinks point to. shutil.copytree(worker_outdir, bazel_outdir, dirs_exist_ok=True) diff --git a/tests/bootstrap_impls/bin_calls_bin/inner.py b/tests/bootstrap_impls/bin_calls_bin/inner.py index 6fef455a84..74a70b5f0d 100644 --- a/tests/bootstrap_impls/bin_calls_bin/inner.py +++ b/tests/bootstrap_impls/bin_calls_bin/inner.py @@ -9,6 +9,7 @@ try: import tests.bootstrap_impls.bin_calls_bin.inner_lib as inner_lib + print(f"inner: import_result='{inner_lib.confirm()}'") except ImportError as e: print(f"inner: import_result='{e}'") diff --git a/tests/bootstrap_impls/bin_calls_bin/inner_lib.py b/tests/bootstrap_impls/bin_calls_bin/inner_lib.py index 97efbb1565..5815b4f41b 100644 --- a/tests/bootstrap_impls/bin_calls_bin/inner_lib.py +++ b/tests/bootstrap_impls/bin_calls_bin/inner_lib.py @@ -1,3 +1,3 @@ # Rather than having a completely empty file... def confirm(): - return "success" \ No newline at end of file + return "success" diff --git a/tests/cc/current_py_cc_headers/abi3_headers_linkage_test.py b/tests/cc/current_py_cc_headers/abi3_headers_linkage_test.py index 6c337653b1..e8c4847672 100644 --- a/tests/cc/current_py_cc_headers/abi3_headers_linkage_test.py +++ b/tests/cc/current_py_cc_headers/abi3_headers_linkage_test.py @@ -12,7 +12,9 @@ class CheckLinkageTest(unittest.TestCase): @unittest.skipUnless(sys.platform.startswith("win"), "requires windows") def test_linkage_windows(self): rf = runfiles.Create() - dll_path = rf.Rlocation("rules_python/tests/cc/current_py_cc_headers/bin_abi3.dll") + dll_path = rf.Rlocation( + "rules_python/tests/cc/current_py_cc_headers/bin_abi3.dll" + ) pe = pefile.PE(dll_path) if not hasattr(pe, "DIRECTORY_ENTRY_IMPORT"): self.fail("No import directory found.") diff --git a/tests/integration/custom_commands_test.py b/tests/integration/custom_commands_test.py index 288a4e7a91..b4ca74c525 100644 --- a/tests/integration/custom_commands_test.py +++ b/tests/integration/custom_commands_test.py @@ -21,7 +21,12 @@ class CustomCommandsTest(runner.TestCase): # Regression test for https://github.com/bazel-contrib/rules_python/issues/1840 def test_run_build_python_zip_false(self): - result = self.run_bazel("run", "--build_python_zip=false", "--@rules_python//python/config_settings:build_python_zip=false", "//:bin") + result = self.run_bazel( + "run", + "--build_python_zip=false", + "--@rules_python//python/config_settings:build_python_zip=false", + "//:bin", + ) self.assert_result_matches(result, "bazel-out") diff --git a/tests/integration/pip_parse_isolated/test_isolated.py b/tests/integration/pip_parse_isolated/test_isolated.py index f889f071fb..5620801955 100644 --- a/tests/integration/pip_parse_isolated/test_isolated.py +++ b/tests/integration/pip_parse_isolated/test_isolated.py @@ -3,9 +3,10 @@ See MODULE.bazel. """ -import six import unittest +import six + class TestIsolated(unittest.TestCase): def test_import(self): diff --git a/tests/integration/toolchain_target_settings/main.py b/tests/integration/toolchain_target_settings/main.py index 6ae68c3f51..52ec605a55 100644 --- a/tests/integration/toolchain_target_settings/main.py +++ b/tests/integration/toolchain_target_settings/main.py @@ -1,2 +1,3 @@ import sys + print(f"Python {sys.version}") diff --git a/tests/toolchains/custom_platform_toolchain_test.py b/tests/toolchains/custom_platform_toolchain_test.py index fd28cf772e..e42655f3de 100644 --- a/tests/toolchains/custom_platform_toolchain_test.py +++ b/tests/toolchains/custom_platform_toolchain_test.py @@ -8,7 +8,8 @@ def test_custom_platform_interpreter_used(self): # For lack of a better option, check the version. Identifying the self.assertEqual( "3.13.1", - f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}") + f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}", + ) if __name__ == "__main__": diff --git a/tests/tools/wheelmaker_test.py b/tests/tools/wheelmaker_test.py index 7c30981e83..cc160869df 100644 --- a/tests/tools/wheelmaker_test.py +++ b/tests/tools/wheelmaker_test.py @@ -35,14 +35,10 @@ def test_quote_all_false_leaves_simple_filenames_unquoted(self) -> None: def test_quote_all_quotes_filenames_with_commas(self) -> None: """Filenames with commas are always quoted, regardless of quote_all_filenames.""" whl = self._make_whl_file(quote_all=True) - self.assertEqual( - whl._quote_filename("foo,bar/baz.py"), '"foo,bar/baz.py"' - ) + self.assertEqual(whl._quote_filename("foo,bar/baz.py"), '"foo,bar/baz.py"') whl = self._make_whl_file(quote_all=False) - self.assertEqual( - whl._quote_filename("foo,bar/baz.py"), '"foo,bar/baz.py"' - ) + self.assertEqual(whl._quote_filename("foo,bar/baz.py"), '"foo,bar/baz.py"') @dataclass @@ -145,9 +141,7 @@ def test_requirement(self): self.assertEqual(result, "Requires-Dist: requests>=2.0") def test_requirement_and_extra(self): - result = wheelmaker.get_new_requirement_line( - "requests>=2.0", "extra=='dev'" - ) + result = wheelmaker.get_new_requirement_line("requests>=2.0", "extra=='dev'") self.assertEqual(result, "Requires-Dist: requests>=2.0; extra=='dev'") def test_requirement_with_url(self): diff --git a/tools/wheelmaker.py b/tools/wheelmaker.py index ada525e9bf..093bba7496 100644 --- a/tools/wheelmaker.py +++ b/tools/wheelmaker.py @@ -94,9 +94,7 @@ def normalize_pep440(version): substituted = re.sub(r"\{\w+\}", "0", version) delimiter = "." if "+" in substituted else "+" try: - return str( - packaging.version.Version(f"{substituted}{delimiter}{sanitized}") - ) + return str(packaging.version.Version(f"{substituted}{delimiter}{sanitized}")) except packaging.version.InvalidVersion: return str(packaging.version.Version(f"0+{sanitized}")) @@ -120,9 +118,7 @@ def arcname_from( # Always use unix path separators. normalized_arcname = name.replace(os.path.sep, "/") # Don't manipulate names filenames in the .distinfo or .data directories. - if distribution_prefix and normalized_arcname.startswith( - distribution_prefix - ): + if distribution_prefix and normalized_arcname.startswith(distribution_prefix): return normalized_arcname for prefix in strip_path_prefixes: if normalized_arcname.startswith(prefix): @@ -205,9 +201,7 @@ def add_string(self, filename, contents): self.writestr(zinfo, contents) hash = hashlib.sha256() hash.update(contents) - self._add_to_record( - filename, self._serialize_digest(hash), len(contents) - ) + self._add_to_record(filename, self._serialize_digest(hash), len(contents)) def _serialize_digest(self, hash) -> str: # https://www.python.org/dev/peps/pep-0376/#record @@ -244,9 +238,7 @@ def _quote_filename(self, filename: str) -> str: filename = filename.lstrip("/") # Some RECORDs like torch have *all* filenames quoted and we must minimize diff. # Otherwise, we quote only when necessary (e.g. for filenames with commas). - quoting = ( - csv.QUOTE_ALL if self.quote_all_filenames else csv.QUOTE_MINIMAL - ) + quoting = csv.QUOTE_ALL if self.quote_all_filenames else csv.QUOTE_MINIMAL with io.StringIO() as buf: csv.writer(buf, quoting=quoting).writerow([filename]) return buf.getvalue().strip() @@ -288,8 +280,8 @@ def __init__( self._strip_path_prefixes = strip_path_prefixes self._add_path_prefix = add_path_prefix self._compress = compress - self._wheelname_fragment_distribution_name = ( - escape_filename_distribution_name(self._name) + self._wheelname_fragment_distribution_name = escape_filename_distribution_name( + self._name ) self._distribution_prefix = ( @@ -361,9 +353,7 @@ def add_metadata(self, metadata, name, description): """Write METADATA file to the distribution.""" # https://www.python.org/dev/peps/pep-0566/ # https://packaging.python.org/specifications/core-metadata/ - metadata = re.sub( - "^Name: .*$", "Name: %s" % name, metadata, flags=re.MULTILINE - ) + metadata = re.sub("^Name: .*$", "Name: %s" % name, metadata, flags=re.MULTILINE) metadata += "Version: %s\n\n" % self._version # setuptools seems to insert UNKNOWN as description when none is # provided. @@ -442,9 +432,7 @@ def resolve_argument_stamp( def parse_args() -> argparse.Namespace: parser = argparse.ArgumentParser(description="Builds a python wheel") - metadata_group = parser.add_argument_group( - "Wheel name, version and platform" - ) + metadata_group = parser.add_argument_group("Wheel name, version and platform") metadata_group.add_argument( "--name", required=True, type=str, help="Name of the distribution" ) @@ -643,9 +631,7 @@ def main() -> None: if not meta_line[len("Requires-Dist: ") :].startswith("@"): # This is a normal requirement. - package, _, extra = meta_line[ - len("Requires-Dist: ") : - ].rpartition(";") + package, _, extra = meta_line[len("Requires-Dist: ") :].rpartition(";") if not package: # This is when the package requirement does not have markers. continue @@ -660,9 +646,7 @@ def main() -> None: extra = extra.strip() reqs = [] - for reqs_line in ( - Path(file).read_text(encoding="utf-8").splitlines() - ): + for reqs_line in Path(file).read_text(encoding="utf-8").splitlines(): reqs_text = reqs_line.strip() if not reqs_text or reqs_text.startswith(("#", "-")): continue From 212be824c4dec9128b847dec3c1e38acadeef7d7 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sat, 16 May 2026 13:52:05 +0900 Subject: [PATCH 3/3] doc: add changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3feaebf428..98b96ad94e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,8 @@ END_UNRELEASED_TEMPLATE ### Removed * (coverage) Support for python 3.8 has been dropped from the bundled `coverage.py` wheel set, since coverage.py 7.6.2 dropped it. +* (workspace) Support for `WORKSPACE` has been dropped from `rules_python`, please + update your setup to use `bzlmod`. {#v0-0-0-changed} ### Changed