-
Notifications
You must be signed in to change notification settings - Fork 556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Metadata to aid static analysis #2537
Comments
Just a note for future selves - sometimes One question though is what happens if the user hasn't specified the types deps in the Thinking about this more, I have a feeling that automatically propagating stubs from the external typing stub packages is probably a separate ticket as its scope is too large. Initially (as part of this ticket) we should only handle the |
This adds attributes and fields of use to static analysis. For type definition files (usually `.pyi` files), the `pyi_srcs` and `pyi_deps` fields are added to the rules. They end up in the PyInfo fields direct_pyi_files and transitive_pyi_files. So that static analysis tools can retain access to a target's Python source files, even if precompiling is enabled, `direct_original_sources` and `transitive_original_sources` fields are added to PyInfo. Work towards #2537, #296
Make pypi-generated targets set `pyi_srcs` to include `*.pyi` files. Work towards #2537
All the items in the todo are done! If downstream users could try using them / migrate to them, and provide feedback, that would be the last missing piece. I'm going to leave this open for a bit before closing. |
Static analysis tools need additional information to help understand Python targets correctly. The use case of particular note are type checkers.
See discussion #2455_
At a minimum, these tools need the original source files. For type checkers, pyi files are also needed. Similarly, things like proto (or other code gen) would also benefit from a way to provide pyi files.
{direct, transitive} x {original_sources, pyi_files}
py_library.{pyi_{srcs, deps}
py_library
et al to populate, merge, propagate this informationThe text was updated successfully, but these errors were encountered: