GH-49831: [Python] Withhold py.typed from the wheel until stubs are complete#50168
GH-49831: [Python] Withhold py.typed from the wheel until stubs are complete#50168rok wants to merge 1 commit into
Conversation
|
|
There was a problem hiding this comment.
Pull request overview
This PR aims to prevent downstream type checkers from trusting PyArrow’s currently-incomplete bundled type stubs by withholding the PEP 561 py.typed marker from the built wheel (per GH-49831), while keeping stubs and py.typed in-tree for ongoing CI/type-checking work.
Changes:
- Configure the wheel build to exclude
pyarrow/py.typedviawheel.exclude. - Add explanatory comments documenting the rationale and removal TODO.
325b6ac to
860479a
Compare
| source_root = Path(__file__).resolve().parents[2] | ||
| stubs_dir = source_root / "python" / "pyarrow-stubs" / "pyarrow" |
There was a problem hiding this comment.
@rok I strongly recommend excluding the entire directory.
This is all that is in there? 🤨
arrow/python/pyarrow-stubs/pyarrow/__init__.pyi
Lines 24 to 29 in 4fce185
We've been pinning pyarrow<24 and the errors we see in (narwhals-dev/narwhals#3560) will still be there for type checkers that aren't mypy 😔
Rationale for this change
Since 24.0, pyarrow ships a
py.typedmarker while the type stubs are still incomplete. This makes type checkers trust the partial stubs and report false errors in downstream code (e.g. Module has no attribute "all" forpyarrow.compute). See #49831.What changes are included in this PR?
This excludes
pyarrow/py.typedfrom the built wheel via wheel.exclude.Are these changes tested?
Verified on locally installed wheel with
py.typedabsent mypy ignores the bundled stubs.Are there any user-facing changes?
Type checkers no longer pick up pyarrow's incomplete stubs.