aspect-build / aspect-build/rules_lint

[Bug]: ty cannot resolve dependencies from BCR

Open
#873 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Starlark
Stars
154
Forks
125
Avg merge
3d 21h
Merged PRs (30d)
20

Description

### What happened?

The `ty` linter aspect fails to resolve imports from standard Bazel external dependencies (like `abseil-py`'s `absl.testing`) because the linter only populates its search paths using `dep[PyInfo].imports`.

Standard Bazel dependencies package their code directly at the repository root and do not set the `imports` attribute in their `py_library` rules (relying on Bazel's default behavior instead). As a result, `dep[PyInfo].imports` is empty, and the linter search paths miss the dependency's external repository root (e.g., `external/abseil-py+`), leading to an `unresolved-import` error.

### Version

Development (host) and target OS/architectures: linux x64

Output of `bazel --version`: `bazel 9.1.0`

Version of the Aspect rules, or other relevant rules from your
`WORKSPACE` or `MODULE.bazel` file: `2.5.2`

Language(s) and/or frameworks involved: Python & BCR

### How to reproduce

Minimal repro in https://github.com/mp4096/repro-rules-lint

### Any other information?

I first thought this is same root cause as https://github.com/aspect-build/rules_lint/issues/851, but this issue was fixed by https://github.com/aspect-build/rules_lint/pull/832

Contributor guide

Open the contributing guide

Research direction

Start with the ty linter's search-path construction and inspect how dependency PyInfo imports are converted into paths. Run the minimal reproduction at github.com/mp4096/repro-rules-lint, then verify that standard BCR dependencies such as abseil-py resolve absl.testing without an unresolved-import error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.