pantsbuild / pants

The Pants Build System
https://www.pantsbuild.org
Apache License 2.0
3.34k stars 640 forks source link

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

Open relsunkaev opened 2 years ago

relsunkaev commented 2 years ago

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

jsirois commented 2 years ago

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