Conversation
| ```starlark title="MODULE.bazel" | ||
| bazel_dep(name = "aspect_rules_lint", version = "2.0.0") | ||
| ``` | ||
|
|
||
| Then configure how to run ty in a `.bzl` file using [`lint_ty_aspect`](https://registry.bazel.build/docs/aspect_rules_lint#function-lint_ty_aspect): | ||
|
|
||
| ```starlark title="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("//:pyproject.toml"), | ||
| ) | ||
| ``` | ||
|
|
||
| Finally, see the [`aspect_rules_lint` documentation](https://github.com/aspect-build/rules_lint/blob/main/docs/linting.md) for how to run linting (type checking) with Bazel. |
There was a problem hiding this comment.
I successfully tested this setup in a small demo project, but I am not familar with Bazel (anymore), so I would appreciate a second look. We could also shorten this section a lot and just link to https://registry.bazel.build/docs/aspect_rules_lint#function-lint_ty_aspect
There was a problem hiding this comment.
Yeah I think I'd prefer just linking to the aspect_rules_lint docs instead of risking this going out of date and causing confusion.
There was a problem hiding this comment.
Agree - we're working right now to host those docs on our own site docs.aspect.build where we can provide better experience and keep them synced with broader "how to do Python"
There was a problem hiding this comment.
@alexeagle Thank you. It would be great if you could let us know once that's ready so that we can link to the new documentation. I'll merge this in the current state for now.
Summary
Add instructions for running ty via Bazel (using https://registry.bazel.build/docs/aspect_rules_lint#lint-ty-bzl).
Rendered:
closes #2097