buildozer 10.1.0.bcr.1Latest published 1.5mo ago
MODULE.bazel
bazel_dep(name = "buildozer", version = "10.1.0.bcr.1")
README

buildozer

This Bazel module provides a pinned, prebuilt version of buildozer, a tool for manipulating Bazel BUILD files.

Requirements

  • Bazel 7.1.0 or later

Usage

  1. Add the following line to your MODULE.bazel file:
bazel_dep(name = "buildozer", version = "10.1.0", dev_dependency = True)
  1. Run buildozer via bazel run:
bazel run @buildozer -- ...

The -- is optional if you don't need to pass arguments to buildozer that start with a dash.

You can also create an alias for the @buildozer target in your main repo.

Using buildozer in repository rules and module extensions

You can also use buildozer in a repository rule or module extension, i.e., during the loading phase:

  1. Add the following line to your MODULE.bazel file:
bazel_dep(name = "buildozer", version = "10.1.0")
  1. In your repository rule or module extension implementation function, get the path to the buildozer binary as follows:
load("@buildozer//:buildozer.bzl", "BUILDOZER_LABEL")
...
def my_impl(repository_or_module_ctx):
    buildozer = repository_or_module_ctx.path(BUILDOZER_LABEL)
    ...
    repository_or_module_ctx.execute(
        [buildozer, 'set foo bar', '//path/to/pkg:target']
    )

Keep the path call at the top of your implementation function as it may cause a restart of the repository rule.

Alternative usage

If you dont want to or can't load from @buildozer, you can also use the following approach:

  1. Add the following lines to your MODULE.bazel file:
bazel_dep(name = "buildozer", version = "10.1.0")

buildozer_binary = use_extension("@buildozer//:buildozer_binary.bzl", "buildozer_binary")
use_repo(buildozer_binary, "buildozer_binary")
  1. In your repository rule or module extension implementation function, get the path to the buildozer binary as follows:
def my_impl(repository_or_module_ctx):
    # The ".exe" suffix is *not* a typo. It is present on all platforms to support
    # Windows while maintaining a stable label.
    buildozer = repository_or_module_ctx.path(Label("@buildozer_binary//:buildozer.exe"))

About

Pinned, prebuilt versions of buildozer for Bazel projects

@fmeum/buildozer@fmeum

Languages

Shell28.1%

Maintainers

@fmeum

Compatibility

Versions

10.1.0.bcr.1 +12d10% 32026-10-05
10.1.0 +7d2026-09-23
10.0.1 +7.2mo2026-09-15
8.5.1 +6.2mo20% 62026-02-12
8.2.1 +3.0mo43% 132025-08-09
8.2.0.bcr.1 +8d10% 32025-05-09
8.2.0 +2.7mo2025-05-01
8.0.3 +12d3% 12025-02-07
8.0.1 +15d2025-01-25
7.3.1 +7.7mo2025-01-10
7.1.2 +1.2mo10% 32024-05-23
7.1.1.1 +<1h2024-04-18
7.1.1 +20d2024-04-18
7.1.0 +2.0mo2024-03-28
6.4.0.2 +1.5mo3% 12024-01-28
6.4.02023-12-13