Skip to content

Add instructions for how to run ty with Bazel#2711

Merged
sharkdp merged 2 commits intomainfrom
docs-bazel
Feb 4, 2026
Merged

Add instructions for how to run ty with Bazel#2711
sharkdp merged 2 commits intomainfrom
docs-bazel

Conversation

@sharkdp
Copy link
Copy Markdown
Contributor

@sharkdp sharkdp commented Feb 4, 2026

Summary

Add instructions for running ty via Bazel (using https://registry.bazel.build/docs/aspect_rules_lint#lint-ty-bzl).

Rendered:

image

closes #2097

@sharkdp sharkdp added the documentation Improvements or additions to documentation label Feb 4, 2026
Comment thread docs/installation.md Outdated
Comment on lines +176 to +191
```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.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

@sharkdp sharkdp merged commit 338058b into main Feb 4, 2026
12 checks passed
@sharkdp sharkdp deleted the docs-bazel branch February 4, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bazel rules

3 participants