diff --git a/modules/rules_python/1.2.0-rc0/MODULE.bazel b/modules/rules_python/1.2.0-rc0/MODULE.bazel new file mode 100644 index 00000000000..0e7dc82d7e3 --- /dev/null +++ b/modules/rules_python/1.2.0-rc0/MODULE.bazel @@ -0,0 +1,189 @@ +module( + name = "rules_python", + version = "1.2.0-rc0", + compatibility_level = 1, +) + +bazel_dep(name = "bazel_features", version = "1.21.0") +bazel_dep(name = "bazel_skylib", version = "1.7.1") +bazel_dep(name = "rules_cc", version = "0.0.16") +bazel_dep(name = "platforms", version = "0.0.4") + +# Those are loaded only when using py_proto_library +# Use py_proto_library directly from protobuf repository +bazel_dep(name = "protobuf", version = "29.0-rc2", repo_name = "com_google_protobuf") + +internal_deps = use_extension("//python/private:internal_deps.bzl", "internal_deps") +use_repo( + internal_deps, + "pypi__build", + "pypi__click", + "pypi__colorama", + "pypi__importlib_metadata", + "pypi__installer", + "pypi__more_itertools", + "pypi__packaging", + "pypi__pep517", + "pypi__pip", + "pypi__pip_tools", + "pypi__pyproject_hooks", + "pypi__setuptools", + "pypi__tomli", + "pypi__wheel", + "pypi__zipp", + "rules_python_internal", +) + +# We need to do another use_extension call to expose the "pythons_hub" +# repo. +python = use_extension("//python/extensions:python.bzl", "python") + +# The default toolchain to use if nobody configures a toolchain. +# NOTE: This is not a stable version. It is provided for convenience, but will +# change frequently to track the most recent Python version. +# NOTE: The root module can override this. +python.toolchain( + is_default = True, + python_version = "3.11", +) +use_repo( + python, + "python_3_11", + "pythons_hub", + python = "python_versions", +) + +# This call registers the Python toolchains. +register_toolchains("@pythons_hub//:all") + +##################### +# Install twine for our own runfiles wheel publishing and allow bzlmod users to use it. + +pip = use_extension("//python/extensions:pip.bzl", "pip") +pip.parse( + # NOTE @aignas 2024-10-26: We have an integration test that depends on us + # being able to build sdists for this hub, so explicitly set this to False. + download_only = False, + experimental_index_url = "https://pypi.org/simple", + hub_name = "rules_python_publish_deps", + python_version = "3.11", + requirements_by_platform = { + "//tools/publish:requirements_darwin.txt": "osx_*", + "//tools/publish:requirements_linux.txt": "linux_*", + "//tools/publish:requirements_windows.txt": "windows_*", + }, +) +use_repo(pip, "rules_python_publish_deps") + +# Not a dev dependency to allow usage of //sphinxdocs code, which refers to stardoc repos. +bazel_dep(name = "stardoc", version = "0.7.2", repo_name = "io_bazel_stardoc") + +# ===== DEV ONLY DEPS AND SETUP BELOW HERE ===== +bazel_dep(name = "rules_bazel_integration_test", version = "0.27.0", dev_dependency = True) +bazel_dep(name = "rules_testing", version = "0.6.0", dev_dependency = True) +bazel_dep(name = "rules_shell", version = "0.3.0", dev_dependency = True) +bazel_dep(name = "rules_multirun", version = "0.9.0", dev_dependency = True) +bazel_dep(name = "bazel_ci_rules", version = "1.0.0", dev_dependency = True) +bazel_dep(name = "rules_pkg", version = "1.0.1", dev_dependency = True) + +# Extra gazelle plugin deps so that WORKSPACE.bzlmod can continue including it for e2e tests. +# We use `WORKSPACE.bzlmod` because it is impossible to have dev-only local overrides. +bazel_dep(name = "rules_go", version = "0.41.0", dev_dependency = True, repo_name = "io_bazel_rules_go") +bazel_dep(name = "rules_python_gazelle_plugin", version = "0", dev_dependency = True) +bazel_dep(name = "gazelle", version = "0.40.0", dev_dependency = True, repo_name = "bazel_gazelle") + +internal_dev_deps = use_extension( + "//python/private:internal_dev_deps.bzl", + "internal_dev_deps", + dev_dependency = True, +) +use_repo(internal_dev_deps, "buildkite_config", "wheel_for_testing") + +# Add gazelle plugin so that we can run the gazelle example as an e2e integration +# test and include the distribution files. +local_path_override( + module_name = "rules_python_gazelle_plugin", + path = "gazelle", +) + +dev_python = use_extension( + "//python/extensions:python.bzl", + "python", + dev_dependency = True, +) +dev_python.override( + register_all_versions = True, +) + +dev_pip = use_extension( + "//python/extensions:pip.bzl", + "pip", + dev_dependency = True, +) +dev_pip.parse( + download_only = True, + experimental_index_url = "https://pypi.org/simple", + hub_name = "dev_pip", + python_version = "3.11", + requirements_lock = "//docs:requirements.txt", +) +dev_pip.parse( + download_only = True, + experimental_index_url = "https://pypi.org/simple", + hub_name = "dev_pip", + python_version = "3.13.0", + requirements_lock = "//docs:requirements.txt", +) +dev_pip.parse( + download_only = True, + experimental_index_url = "https://pypi.org/simple", + hub_name = "pypiserver", + python_version = "3.11", + requirements_lock = "//examples/wheel:requirements_server.txt", +) +use_repo(dev_pip, "dev_pip", "pypiserver") + +# Bazel integration test setup below + +bazel_binaries = use_extension( + "@rules_bazel_integration_test//:extensions.bzl", + "bazel_binaries", + dev_dependency = True, +) + +# Keep in sync with //:version.bzl +bazel_binaries.local( + name = "self", + path = "tests/integration/bazel_from_env", +) +bazel_binaries.download(version = "7.4.1") +bazel_binaries.download(version = "8.0.0") + +# For now, don't test with rolling, because that's Bazel 9, which is a ways +# away. +# bazel_binaries.download(version = "rolling") +use_repo( + bazel_binaries, + "bazel_binaries", + # These don't appear necessary, but are reported as direct dependencies + # that should be use_repo()'d, so we add them as requested + "bazel_binaries_bazelisk", + "build_bazel_bazel_7_4_1", + "build_bazel_bazel_8_0_0", + # "build_bazel_bazel_rolling", + "build_bazel_bazel_self", +) + +# EXPERIMENTAL: This is experimental and may be removed without notice +uv = use_extension( + "//python/uv:uv.bzl", + "uv", + dev_dependency = True, +) +uv.toolchain(uv_version = "0.4.25") +use_repo(uv, "uv_toolchains") + +register_toolchains( + "@uv_toolchains//:all", + dev_dependency = True, +) diff --git a/modules/rules_python/1.2.0-rc0/patches/module_dot_bazel_version.patch b/modules/rules_python/1.2.0-rc0/patches/module_dot_bazel_version.patch new file mode 100644 index 00000000000..44545d838a4 --- /dev/null +++ b/modules/rules_python/1.2.0-rc0/patches/module_dot_bazel_version.patch @@ -0,0 +1,12 @@ +=================================================================== +--- a/MODULE.bazel ++++ b/MODULE.bazel +@@ -1,7 +1,7 @@ + module( + name = "rules_python", +- version = "0.0.0", ++ version = "1.2.0-rc0", + compatibility_level = 1, + ) + + bazel_dep(name = "bazel_features", version = "1.21.0") diff --git a/modules/rules_python/1.2.0-rc0/presubmit.yml b/modules/rules_python/1.2.0-rc0/presubmit.yml new file mode 100644 index 00000000000..e1ddb7a1aab --- /dev/null +++ b/modules/rules_python/1.2.0-rc0/presubmit.yml @@ -0,0 +1,32 @@ +# 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. + +bcr_test_module: + module_path: "examples/bzlmod" + matrix: + platform: ["debian11", "macos", "ubuntu2004", "windows"] + # last_rc is to get latest 8.x release. Replace with 8.x when available. + bazel: [7.x, last_rc] + tasks: + run_tests: + name: "Run test module" + platform: ${{ platform }} + bazel: ${{ bazel }} + test_flags: + - "--keep_going" + # Without these cxxopts, BCR's Mac builds fail + - '--cxxopt=-std=c++14' + - '--host_cxxopt=-std=c++14' + test_targets: + - "//..." diff --git a/modules/rules_python/1.2.0-rc0/source.json b/modules/rules_python/1.2.0-rc0/source.json new file mode 100644 index 00000000000..6ec8dcc3e34 --- /dev/null +++ b/modules/rules_python/1.2.0-rc0/source.json @@ -0,0 +1,9 @@ +{ + "integrity": "sha256-TQ+KAqZw4DaWhg0rCNeQ7usTRzz6WCu1eeJS3Z4HmuI=", + "strip_prefix": "rules_python-1.2.0-rc0", + "url": "https://github.com/bazelbuild/rules_python/releases/download/1.2.0-rc0/rules_python-1.2.0-rc0.tar.gz", + "patches": { + "module_dot_bazel_version.patch": "sha256-Y23DWupxg7ONWG8EWa/+C4TsD0ySocPCYs1PwmDXdqE=" + }, + "patch_strip": 1 +} diff --git a/modules/rules_python/metadata.json b/modules/rules_python/metadata.json index 3b64a57b6ab..5fed03f10e6 100644 --- a/modules/rules_python/metadata.json +++ b/modules/rules_python/metadata.json @@ -64,7 +64,8 @@ "1.0.0", "1.1.0-rc0", "1.1.0-rc1", - "1.1.0" + "1.1.0", + "1.2.0-rc0" ], "yanked_versions": { "0.14.0": "rules_python 0.14.0 is broken due to https://github.com/bazelbuild/bazel-central-registry/issues/287, please upgrade to version >= 0.15.0" diff --git a/modules/rules_python_gazelle_plugin/1.2.0-rc0/MODULE.bazel b/modules/rules_python_gazelle_plugin/1.2.0-rc0/MODULE.bazel new file mode 100644 index 00000000000..617e456df8a --- /dev/null +++ b/modules/rules_python_gazelle_plugin/1.2.0-rc0/MODULE.bazel @@ -0,0 +1,47 @@ +module( + name = "rules_python_gazelle_plugin", + version = "1.2.0-rc0", + compatibility_level = 1, +) + +bazel_dep(name = "bazel_skylib", version = "1.6.1") +bazel_dep(name = "rules_python", version = "0.18.0") +bazel_dep(name = "rules_go", version = "0.41.0", repo_name = "io_bazel_rules_go") +bazel_dep(name = "gazelle", version = "0.33.0", repo_name = "bazel_gazelle") +bazel_dep(name = "rules_cc", version = "0.0.16") + +local_path_override( + module_name = "rules_python", + path = "..", +) + +go_deps = use_extension("@bazel_gazelle//:extensions.bzl", "go_deps") +go_deps.from_file(go_mod = "//:go.mod") +use_repo( + go_deps, + "com_github_bazelbuild_buildtools", + "com_github_bmatcuk_doublestar_v4", + "com_github_dougthor42_go_tree_sitter", + "com_github_emirpasic_gods", + "com_github_ghodss_yaml", + "com_github_stretchr_testify", + "in_gopkg_yaml_v2", + "org_golang_x_sync", +) + +python_stdlib_list = use_extension("//python:extensions.bzl", "python_stdlib_list") +use_repo( + python_stdlib_list, + "python_stdlib_list", +) + +internal_dev_deps = use_extension( + "//:internal_dev_deps.bzl", + "internal_dev_deps_extension", + dev_dependency = True, +) +use_repo( + internal_dev_deps, + "django-types", + "pytest", +) diff --git a/modules/rules_python_gazelle_plugin/1.2.0-rc0/patches/module_dot_bazel_version.patch b/modules/rules_python_gazelle_plugin/1.2.0-rc0/patches/module_dot_bazel_version.patch new file mode 100644 index 00000000000..b4bf4fd92e5 --- /dev/null +++ b/modules/rules_python_gazelle_plugin/1.2.0-rc0/patches/module_dot_bazel_version.patch @@ -0,0 +1,12 @@ +=================================================================== +--- a/MODULE.bazel ++++ b/MODULE.bazel +@@ -1,7 +1,7 @@ + module( + name = "rules_python_gazelle_plugin", +- version = "0.0.0", ++ version = "1.2.0-rc0", + compatibility_level = 1, + ) + + bazel_dep(name = "bazel_skylib", version = "1.6.1") diff --git a/modules/rules_python_gazelle_plugin/1.2.0-rc0/presubmit.yml b/modules/rules_python_gazelle_plugin/1.2.0-rc0/presubmit.yml new file mode 100644 index 00000000000..bceed4f9e1a --- /dev/null +++ b/modules/rules_python_gazelle_plugin/1.2.0-rc0/presubmit.yml @@ -0,0 +1,30 @@ +# 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. + +bcr_test_module: + module_path: "../examples/bzlmod_build_file_generation" + matrix: + platform: ["debian11", "macos", "ubuntu2004", "windows"] + # last_rc is to get latest 8.x release. Replace with 8.x when available. + bazel: [7.x, last_rc] + tasks: + run_tests: + name: "Run test module" + platform: ${{ platform }} + bazel: ${{ bazel }} + build_targets: + - "//..." + - ":modules_map" + test_targets: + - "//..." diff --git a/modules/rules_python_gazelle_plugin/1.2.0-rc0/source.json b/modules/rules_python_gazelle_plugin/1.2.0-rc0/source.json new file mode 100644 index 00000000000..d0e1f8bb7d0 --- /dev/null +++ b/modules/rules_python_gazelle_plugin/1.2.0-rc0/source.json @@ -0,0 +1,9 @@ +{ + "integrity": "sha256-TQ+KAqZw4DaWhg0rCNeQ7usTRzz6WCu1eeJS3Z4HmuI=", + "strip_prefix": "rules_python-1.2.0-rc0/gazelle", + "url": "https://github.com/bazelbuild/rules_python/releases/download/1.2.0-rc0/rules_python-1.2.0-rc0.tar.gz", + "patches": { + "module_dot_bazel_version.patch": "sha256-dC0xdJQk6mClrWOQoGZ1EIE9IQzCGw8hOz99WDpPfGw=" + }, + "patch_strip": 1 +} diff --git a/modules/rules_python_gazelle_plugin/metadata.json b/modules/rules_python_gazelle_plugin/metadata.json index b48ba211de6..b6e0a9beccb 100644 --- a/modules/rules_python_gazelle_plugin/metadata.json +++ b/modules/rules_python_gazelle_plugin/metadata.json @@ -47,7 +47,8 @@ "1.0.0", "1.1.0-rc0", "1.1.0-rc1", - "1.1.0" + "1.1.0", + "1.2.0-rc0" ], "yanked_versions": {} }