pants icon indicating copy to clipboard operation
pants copied to clipboard

`pantsbuild.pants` missing top-level `__init__.py` causes type checkers to ignore the `py.typed` marker

Open relsunkaev opened this issue 2 years ago • 1 comments

Describe the bug When importing anything from pantsbuild.pants while using strict type checking, an error is reported claiming that the package is missing type stubs. The package is missing a top level __init__.py file, causing type checkers to interpret each package inside pants build.pants as wholly separate and requiring their own py.typed files. This was confirmed with both MyPy and Pyright.

Pants version pantsbuild.pants==2.12.1rc2

relsunkaev avatar Jul 31 '22 04:07 relsunkaev

It looks like we run afoul of the 3rd paragraph here since we do continue to need to ship pants as a namespace package: https://peps.python.org/pep-0561/#packaging-type-information

jsirois avatar Jul 31 '22 17:07 jsirois