> ## Documentation Index
> Fetch the complete documentation index at: https://aspect.build/llms.txt
> Use this file to discover all available pages before exploring further.

# Bazelrc

`function` **Bazelrc.bool\_flag**

<pre language="python">
  `def Bazelrc.bool_flag(
  name: str,
  /,
  *,
  command: str,
  version: None | str = None
  ) -> None | bool`
</pre>

The tri-state of boolean `--name` for `command`: `True` for `--name` / `--name=true`, `False` for `--noname` / `--name=false`, `None` if unset. The caller owns the default when `None` (e.g. `--enable_bzlmod` defaults on for Bazel 7+).

`function` **Bazelrc.expand**

<pre language="python">
  `def Bazelrc.expand(
  *,
  command: str
  ) -> list`
</pre>

Expand all `--config=` flags for `command` into the fully-resolved flag list, compatible with `ctx.bazel.build(flags=...)`.

Version-gated options are filtered to the bazelrc's resolved Bazel
version (same as `flag_value` / `resolve_for_command`), so the result
reflects what Bazel actually receives — an option gated to a different
version is dropped rather than reported as active.

`function` **Bazelrc.expand\_all**

<pre language="python">
  `def Bazelrc.expand_all(
  *,
  command: str
  ) -> (list, list)`
</pre>

Expand `--config=` flags for `command`, split into `(startup_flags, flags)` where `common`-section options are rendered as `--default_override=0:common=...` startup-side entries.

Like `expand`, the command flags are filtered to the resolved Bazel
version so version-gated options report accurately.

`function` **Bazelrc.flag\_value**

<pre language="python">
  `def Bazelrc.flag_value(
  name: str,
  /,
  *,
  command: str,
  version: None | str = None
  ) -> None | str`
</pre>

The effective value of `--name` for `command`, or `None` if unset. Last-write-wins over the config-expanded options; matches `--name=VALUE` and the two-token `--name VALUE` form. `version` overrides the Bazel version used for version-gated options.

`function` **Bazelrc.flag\_values**

<pre language="python">
  `def Bazelrc.flag_values(
  name: str,
  /,
  *,
  command: str,
  version: None | str = None
  ) -> list`
</pre>

All values of a repeatable `--name` option for `command`, in order — for flags that legitimately accumulate (`--aspects`, `--output_groups`, …).

`function` **Bazelrc.merge**

<pre language="python">
  `def Bazelrc.merge(
  other: bazel.Bazelrc,
  /
  ) -> bazel.Bazelrc`
</pre>

Overlay `other` on top of this bazelrc, returning a new one. `other` wins on conflicts (its options apply after this one's under last-write-wins); startup flags, `--config` skip policy, and `version` are merged with `other` taking precedence when set. Neither input is mutated.

`function` **Bazelrc.options\_for**

<pre language="python">
  `def Bazelrc.options_for(
  *,
  command: str
  ) -> list`
</pre>

Options applicable to `command` without expanding `--config=`. Each item is a `str` or a `(flag, version_condition)` tuple.

`function` **Bazelrc.sources**

<pre language="python">
  `def Bazelrc.sources() -> list`
</pre>

The source file paths that were loaded.

`function` **Bazelrc.startup\_flags**

<pre language="python">
  `def Bazelrc.startup_flags() -> list`
</pre>

The startup flags Bazel runs with under this bazelrc: the user startup flags + the rc-file `startup` section + `--ignore_all_rc_files`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.