diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 2f923016f8..43e519259c 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -433,31 +433,6 @@ tasks: # 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_pip_repository_annotations_ubuntu_workspace: - <<: *reusable_build_test_all - <<: *common_workspace_flags - name: "examples/pip_repository_annotations: Ubuntu, workspace" - working_directory: examples/pip_repository_annotations - platform: ubuntu2204 - integration_test_pip_repository_annotations_debian_workspace: - <<: *reusable_build_test_all - <<: *common_workspace_flags - name: "examples/pip_repository_annotations: Debian, workspace" - working_directory: examples/pip_repository_annotations - platform: debian11 - integration_test_pip_repository_annotations_macos_workspace: - <<: *reusable_build_test_all - <<: *common_workspace_flags - name: "examples/pip_repository_annotations: macOS, workspace" - working_directory: examples/pip_repository_annotations - platform: macos_arm64 - integration_test_pip_repository_annotations_windows_workspace: - <<: *reusable_build_test_all - <<: *common_workspace_flags - name: "examples/pip_repository_annotations: Windows, workspace" - working_directory: examples/pip_repository_annotations - platform: windows - integration_test_bazelinbazel_ubuntu: <<: *common_bazelinbazel_config name: "tests/integration bazel-in-bazel: Ubuntu" diff --git a/examples/pip_repository_annotations/.bazelrc b/examples/pip_repository_annotations/.bazelrc deleted file mode 100644 index 9397bd31b8..0000000000 --- a/examples/pip_repository_annotations/.bazelrc +++ /dev/null @@ -1,9 +0,0 @@ -# https://docs.bazel.build/versions/main/best-practices.html#using-the-bazelrc-file -try-import %workspace%/user.bazelrc - -# This example is WORKSPACE specific. The equivalent functionality -# is in examples/bzlmod as the `whl_mods` feature. -common --noenable_bzlmod -common --enable_workspace -common --legacy_external_runfiles=false -common --incompatible_python_disallow_native_rules diff --git a/examples/pip_repository_annotations/.gitignore b/examples/pip_repository_annotations/.gitignore deleted file mode 100644 index a6ef824c1f..0000000000 --- a/examples/pip_repository_annotations/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/bazel-* diff --git a/examples/pip_repository_annotations/WORKSPACE b/examples/pip_repository_annotations/WORKSPACE deleted file mode 100644 index 8540555084..0000000000 --- a/examples/pip_repository_annotations/WORKSPACE +++ /dev/null @@ -1,62 +0,0 @@ -workspace(name = "pip_repository_annotations_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", "package_annotation", "pip_parse") - -# Here we can see an example of annotations being applied to an arbitrary -# package. For details on `package_annotation` and it's uses, see the -# docs at @rules_python//docs:pip.md`. -ANNOTATIONS = { - # This annotation verifies that annotations work correctly for pip packages with extras - # specified, in this case requests[security]. - "requests": package_annotation( - additive_build_content = """\ -load("@bazel_skylib//rules:write_file.bzl", "write_file") -write_file( - name = "generated_file", - out = "generated_file.txt", - content = ["Hello world from requests"], -) -""", - data = [":generated_file"], - ), - "wheel": package_annotation( - additive_build_content = """\ -load("@bazel_skylib//rules:write_file.bzl", "write_file") -write_file( - name = "generated_file", - out = "generated_file.txt", - content = ["Hello world from build content file"], -) -""", - copy_executables = {"@pip_repository_annotations_example//:data/copy_executable.py": "copied_content/executable.py"}, - copy_files = {"@pip_repository_annotations_example//:data/copy_file.txt": "copied_content/file.txt"}, - data = [":generated_file"], - data_exclude_glob = ["site-packages/*.dist-info/WHEEL"], - ), -} - -# For a more thorough example of `pip_parse`. See `@rules_python//examples/pip_parse` -pip_parse( - name = "pip", - annotations = ANNOTATIONS, - python_interpreter_target = "@python39_host//:python", - requirements_lock = "//:requirements.txt", -) - -load("@pip//:requirements.bzl", "install_deps") - -install_deps() diff --git a/examples/pip_repository_annotations/data/copy_executable.py b/examples/pip_repository_annotations/data/copy_executable.py deleted file mode 100755 index 5cb1af7fdb..0000000000 --- a/examples/pip_repository_annotations/data/copy_executable.py +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env python -# 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. - - -if __name__ == "__main__": - print("Hello world from copied executable") diff --git a/examples/pip_repository_annotations/data/copy_file.txt b/examples/pip_repository_annotations/data/copy_file.txt deleted file mode 100644 index b1020f7b95..0000000000 --- a/examples/pip_repository_annotations/data/copy_file.txt +++ /dev/null @@ -1 +0,0 @@ -Hello world from copied file diff --git a/examples/pip_repository_annotations/requirements.in b/examples/pip_repository_annotations/requirements.in deleted file mode 100644 index c9afafc6f5..0000000000 --- a/examples/pip_repository_annotations/requirements.in +++ /dev/null @@ -1,7 +0,0 @@ -# This flag allows for regression testing requirements arguments in -# `pip_repository` rules. ---extra-index-url https://pypi.org/simple/ - -certifi>=2023.7.22 # https://security.snyk.io/vuln/SNYK-PYTHON-CERTIFI-5805047 -wheel -requests[security]>=2.8.1 diff --git a/examples/pip_repository_annotations/requirements.txt b/examples/pip_repository_annotations/requirements.txt deleted file mode 100644 index f1069a7452..0000000000 --- a/examples/pip_repository_annotations/requirements.txt +++ /dev/null @@ -1,34 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.9 -# by the following command: -# -# bazel run //:requirements.update -# ---extra-index-url https://pypi.org/simple/ - -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.7 \ - --hash=sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc \ - --hash=sha256:82fee1fc78add43492d3a1898bfa6d8a904cc97d8427f683ed8e798d07761aa0 - # via requests -requests[security]==2.28.1 \ - --hash=sha256:7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983 \ - --hash=sha256:8fefa2a1a1365bf5520aac41836fbee479da67864514bdb821f31ce07ce65349 - # via -r requirements.in -urllib3==1.26.18 \ - --hash=sha256:34b97092d7e0a3a8cf7cd10e386f401b3737364026c45e622aa02903dffe0f07 \ - --hash=sha256:f8ecc1bba5667413457c529ab955bf8c67b45db799d159066261719e328580a0 - # via requests -wheel==0.38.4 \ - --hash=sha256:965f5259b566725405b05e7cf774052044b1ed30119b5d586b2703aafe8719ac \ - --hash=sha256:b60533f3f5d530e971d6737ca6d58681ee434818fab630c83a734bb10c083ce8 - # via -r requirements.in diff --git a/python/private/pypi/pip_repository.bzl b/python/private/pypi/pip_repository.bzl index 489c124135..6d38334cc6 100644 --- a/python/private/pypi/pip_repository.bzl +++ b/python/private/pypi/pip_repository.bzl @@ -266,8 +266,7 @@ pip_repository = repository_rule( 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. For example usage, see [this WORKSPACE -file](https://github.com/bazel-contrib/rules_python/blob/main/examples/pip_repository_annotations/WORKSPACE). +generated using the `package_name` macro. """, ), _config_template = attr.label(