Skip to content

Error output "Searched in the following paths..." is very long when using bazel #1267

@jasonprado

Description

@jasonprado

Summary

My bazel monorepo has hundreds of python dependencies and when a missing module import is detected the error output grows very, very long. Example:

error[unresolved-import]: Cannot resolve imported module `deploy.cdk_stack`
  --> services/some_app/some_file.py:10:6
   |
10 | from does.not.exist import SomeClass
   |      ^^^^^^^^^^^^^^^^
   |
info: Searched in the following paths during module resolution:
info:   1. /my-repo (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /my-reppo/.venv/lib/python3.12/site-packages (site-packages)
info:   4. /home/my-user/.cache/bazel/_bazel_my-user/0b37e5958ef8909453aa6cc50b6ee420/execroot/_main/bazel-out/aarch64-fastbuild/bin/build_tools/python_tools/venv.runfiles (editable install)
...
[800 more bazel "editable install" locations]

This is a bit burdensome but it sure is explicit. I'm not sure the behavior I want; maybe a more verbose or less verbose mode? I think outputting all 800 paths is probably not valuable. Collapsing similar ones then giving me an invocation I could run to get the full list would be nice. And ty is so fast I wouldn't mind running it again immediately.

Version

ty 0.0.1-alpha.21

Metadata

Metadata

Assignees

No one assigned

    Labels

    diagnosticsRelated to reporting of diagnostics.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions