You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Add PyInfo fields: {direct, transitive} x {original_sources, pyi_files}
Add py_library.{pyi_{srcs, deps}
Update py_library et al to populate, merge, propagate this information
Update pypi generation code to set attributes appropriately.
The text was updated successfully, but these errors were encountered:
Just a note for future selves - sometimes whl metadata has extra dependencies for type checking that are not included by default and we could potentially leverage the same heuristics as used in #2425 - i.e. the types packages have special names that are/can be easy to detect.
One question though is what happens if the user hasn't specified the types deps in the hub repo requirements? I am somewhat concerned that this could brake bazel query if the type stubs are not present.
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 pyi files that are present in the whl_library repos.
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
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: