Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.aspect.build/llms.txt

Use this file to discover all available pages before exploring further.

API for declaring a Ty lint aspect that visits py_binary, library, test rules. Typical usage: Ty is provided as a built-in tool by rules_lint. To use the built-in version, create the linter aspect, typically in tools/lint/linters.bzl:
load("@aspect_rules_lint//lint:ty.bzl", "lint_ty_aspect")

ty = lint_ty_aspect(
    binary = Label("@aspect_rules_lint//lint:ty_bin"),
    config = Label("//:ty.toml"),
)

Function: ty_action

Run ty as an action under Bazel. ty supports persistent configuration files at both the project- and user-level as documented here: https://docs.astral.sh/ty/configuration/ Note: all config files are passed to the action. This means that a change to any config file invalidates the action cache entries for ALL ty actions.

Parameters

ctx
unknown
required
Bazel Rule or Aspect evaluation context
executable
unknown
required
label of the the ty program
srcs
unknown
required
python files to be linted
transitive_srcs
unknown
required
depset of transitive Python sources from dependencies
config
unknown
required
labels of ty config files (pyproject.toml, ty.toml)
stdout
unknown
required
output file of linter results to generate
exit_code
unknown
default:"None"
output file to write the exit code. If None, then fail the build when ty exits non-zero. https://docs.astral.sh/ty/reference/exit-codes/
env
unknown
default:"{}"
environment variables for ty
extra_search_paths
unknown
default:"[]"
list of paths to add as —extra-search-path for third-party module resolution
color
unknown
default:"True"
whether to enable color output (—color always) or disable it (—color never)

Function: lint_ty_aspect

A factory function to create a linter aspect. Attrs: binary: a ty executable configs: ty config file(s) (pyproject.toml, ty.toml) rule_kinds: which kinds of rules should be visited by the aspect filegroup_tags: filegroups tagged with these tags will be visited by the aspect in addition to Python rule kinds

Parameters

binary
unknown
required
config
unknown
required
rule_kinds
unknown
default:"[\"py_binary\", \"py_library\", \"py_test\"]"
filegroup_tags
unknown
default:"[\"python\", \"lint-with-ty\"]"