Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .agents/rules/rules_python.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ description: rules_python-specific Bzlmod, PyPI, and rule usage invariants
to the same name).

## Minimum Supported Bazel Version
* `//:version.bzl` defines `MINIMUM_BAZEL_VERSION`. Do not add compatibility
logic, feature guards, or comments for older Bazel versions.
* When guarding a feature added after `MINIMUM_BAZEL_VERSION`, verify and
comment the exact Bazel version that introduced it.
* The minimum supported Bazel version is the `bazel` version of
`.minimum_supported_version` in `.bazelci/presubmit.yml`. Do not add
compatibility logic, feature guards, or comments for older Bazel versions.
* When guarding a feature added after the minimum supported Bazel version,
verify and comment the exact Bazel version that introduced it.

## Internal Labels & Helpers
* **Toolchain Type Labels**: Define toolchain type constants in
Expand Down
2 changes: 1 addition & 1 deletion .agents/skills/review-code/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ file from `.agents/skills/review-code/`:
- Prompt file:
`.agents/skills/review-code/review-rules-python-prompt.md`
- Focus: Audits changes against `.agents/rules/rules_python.md` (e.g.,
`pip.dep()` declarations in `MODULE.bazel` and `MINIMUM_BAZEL_VERSION`
`pip.dep()` declarations in `MODULE.bazel` and minimum Bazel version
bounds).

9. **News Entry Sub-Agent** (`Role: "News Entry Auditor"`):
Expand Down
6 changes: 3 additions & 3 deletions .agents/skills/review-code/review-rules-python-prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ You are a specialized `rules_python` Usage Auditor sub-agent.
Your sole task is to audit all changes in `git diff` against `rules_python`
Bzlmod, Bazel version support, and rule usage invariants:

1. Read and strictly enforce `.agents/rules/rules_python.md`, `version.bzl`, and
`AGENTS.md`.
1. Read and strictly enforce `.agents/rules/rules_python.md` and `AGENTS.md`.
2. Verify that every `@pypi//<pkg>` target referenced by non-test rules,
macros, or `BUILD` files under `python/**` (including default attribute
values and `alias` targets) has a corresponding `pip.dep(name = "<pkg>")`
declaration on the non-dev `pip` extension in `MODULE.bazel` (with `"pypi"`
in `use_repo(pip, ...)`).
3. Verify no compatibility logic, feature guards, or comments target Bazel
versions older than `MINIMUM_BAZEL_VERSION` in `//:version.bzl`.
versions older than the minimum supported Bazel version in
`.bazelci/presubmit.yml`.

@.agents/skills/review-code/review-report-format.md
3 changes: 2 additions & 1 deletion .agents/skills/review-code/review-starlark-prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ in `git diff` against the project's Starlark coding rules and conventions:
10. Verify non-obvious workarounds have comments stating the intent, why the
direct approach fails, and why the workaround works.
11. Verify no compatibility logic or feature guards target Bazel versions
older than `MINIMUM_BAZEL_VERSION` in `//:version.bzl`.
older than the minimum supported Bazel version in
`.bazelci/presubmit.yml`.
12. Inspect the full `BUILD` file (not just the diff hunk) to flag overlapping
or redundant `filegroup`, `exports_files`, or `glob(...)` definitions, and
flag top-level target-instantiation ternaries (`rule_a(...) if cond else
Expand Down
2 changes: 0 additions & 2 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ buildifier:
warnings: "all"
# LINT.ThenChange(//.pre-commit-config.yaml:buildifier)
# NOTE: Minimum supported version is 7.x
# LINT.IfChange(minimum_supported_version)
.minimum_supported_version: &minimum_supported_version
# For testing minimum supported version.
bazel: 7.x
skip_in_bazel_downstream_pipeline: "Bazel 7 required"
# LINT.ThenChange(//version.bzl:minimum_bazel_version)
.reusable_config: &reusable_config
# USE_BAZEL_DIFF is disabled because target_compatible_with is used heavily,
# but BazelCI's bazel-diff integration errors when handling them.
Expand Down
5 changes: 3 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,9 @@ This repository contains 3 Bazel bzlmod modules.
public API. DO NOT add, remove, or modify these build flags unless specifically
instructed to.

`version.bzl` defines `MINIMUM_BAZEL_VERSION`. Do not add compatibility logic
or feature guards for Bazel versions older than `MINIMUM_BAZEL_VERSION`.
The minimum supported Bazel version is the `bazel` version of
`.minimum_supported_version` in `.bazelci/presubmit.yml`. Do not add
compatibility logic or feature guards for older Bazel versions.

`bazel query --output=build` can be used to inspect target definitions.

Expand Down
11 changes: 0 additions & 11 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

# Resolve rules_cc Starlark libraries to their correct targets
# gazelle:resolve starlark @rules_cc//cc/common:cc_info.bzl @rules_cc//cc/common:common
# gazelle:resolve starlark @rules_cc//cc/common:cc_common.bzl @rules_cc//cc/common:common
Expand Down Expand Up @@ -56,7 +54,6 @@ licenses(["notice"])
exports_files([
".clippy.toml",
"LICENSE",
"version.bzl",
])

exports_files(
Expand Down Expand Up @@ -108,7 +105,6 @@ filegroup(
"WORKSPACE.bzlmod",
"internal_dev_deps.bzl",
"internal_dev_setup.bzl",
"version.bzl",
":downloader_configs",
"//command_line_option:distribution",
"//crates:distribution",
Expand All @@ -131,11 +127,4 @@ filegroup(
visibility = ["//visibility:public"],
)

# keep
bzl_library(
name = "version",
srcs = ["version.bzl"],
visibility = ["//:__subpackages__"],
)

# No-op change to verify PR metadata checks
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ use_repo(
# "build_bazel_bazel_rolling",
"build_bazel_bazel_self",
)
# LINT.ThenChange(//version.bzl:supported_bazel_versions)
# LINT.ThenChange(//internal_dev_setup.bzl:workspace_bazel_binaries)

# TODO @aignas 2025-01-27: should this be moved to `//python/extensions:uv.bzl` or should
# it stay as it is? I think I may prefer to move it.
Expand Down
10 changes: 8 additions & 2 deletions internal_dev_setup.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
load("@rules_bazel_integration_test//bazel_integration_test:deps.bzl", "bazel_integration_test_rules_dependencies")
load("@rules_bazel_integration_test//bazel_integration_test:repo_defs.bzl", "bazel_binaries")
load("@rules_shell//shell:repositories.bzl", "rules_shell_dependencies", "rules_shell_toolchains")
load("//:version.bzl", "SUPPORTED_BAZEL_VERSIONS")
load("//python:versions.bzl", "MINOR_MAPPING", "TOOL_VERSIONS")
load("//python/private:pythons_hub.bzl", "hub_repo") # buildifier: disable=bzl-visibility
load("//python/private:runtime_env_repo.bzl", "runtime_env_repo") # buildifier: disable=bzl-visibility
Expand Down Expand Up @@ -57,7 +56,14 @@ def rules_python_internal_setup():

bazel_integration_test_rules_dependencies()
bazel_starlib_dependencies()
bazel_binaries(versions = SUPPORTED_BAZEL_VERSIONS)

# The integration tests are not run in the WORKSPACE builds of this repo,
# this is only needed for loading their BUILD files. Bazel 9 and later
# ignore the WORKSPACE files.
# LINT.IfChange(workspace_bazel_binaries)
bazel_binaries(versions = ["7.7.0", "8.5.1"])

# LINT.ThenChange(//MODULE.bazel:bazel_binaries)
bazel_features_deps()
rules_shell_dependencies()
rules_shell_toolchains()
Expand Down
40 changes: 0 additions & 40 deletions version.bzl

This file was deleted.

Loading