Skip to content

[Bug]: ty cannot resolve dependencies from BCR #873

Description

@mp4096

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions