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 #851, but this issue was fixed by #832
What happened?
The
tylinter aspect fails to resolve imports from standard Bazel external dependencies (likeabseil-py'sabsl.testing) because the linter only populates its search paths usingdep[PyInfo].imports.Standard Bazel dependencies package their code directly at the repository root and do not set the
importsattribute in theirpy_libraryrules (relying on Bazel's default behavior instead). As a result,dep[PyInfo].importsis empty, and the linter search paths miss the dependency's external repository root (e.g.,external/abseil-py+), leading to anunresolved-importerror.Version
Development (host) and target OS/architectures: linux x64
Output of
bazel --version:bazel 9.1.0Version of the Aspect rules, or other relevant rules from your
WORKSPACEorMODULE.bazelfile:2.5.2Language(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 #851, but this issue was fixed by #832