Bazel Starlark Build API

Bazel's build rules, macros, and module extensions are written in Starlark — a deterministic Python dialect. The Starlark Build API exposes the rule(), repository_rule(), module_extension(), aspect(), and provider() primitives used to declare build targets, generate actions, and integrate new languages. BUILD, BUILD.bazel, .bzl, MODULE.bazel, and WORKSPACE files are all evaluated by this API.

API entry from apis.yml

apis.yml Raw ↑
aid: bazel-build:bazel-starlark-api
name: Bazel Starlark Build API
description: Bazel's build rules, macros, and module extensions are written in Starlark — a deterministic
  Python dialect. The Starlark Build API exposes the rule(), repository_rule(), module_extension(), aspect(),
  and provider() primitives used to declare build targets, generate actions, and integrate new languages.
  BUILD, BUILD.bazel, .bzl, MODULE.bazel, and WORKSPACE files are all evaluated by this API.
humanURL: https://bazel.build/rules
tags:
- BUILD
- DSL
- Extension
- Rules
- Starlark
properties:
- type: Documentation
  url: https://bazel.build/rules
- type: Documentation
  url: https://bazel.build/rules/language
- type: Documentation
  url: https://bazel.build/extending/concepts
- type: APIReference
  url: https://bazel.build/rules/lib/starlark-overview