Skip to content

GH-49831: [Python] Withhold annotations from Python wheel until they are complete#50168

Open
rok wants to merge 7 commits into
apache:mainfrom
rok:broken-annotations-downstream
Open

GH-49831: [Python] Withhold annotations from Python wheel until they are complete#50168
rok wants to merge 7 commits into
apache:mainfrom
rok:broken-annotations-downstream

Conversation

@rok

@rok rok commented Jun 14, 2026

Copy link
Copy Markdown
Member

Rationale for this change

Since 24.0, pyarrow ships annotations and py.typed marker 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" for pyarrow.compute). Some type checkers also consume bundled .pyi files even without py.typed, so the stubs need to be withheld from wheels for now. See #49831.

What changes are included in this PR?

This temporarily omits both pyarrow/py.typed and the bundled pyarrow-stubs / .pyi files from built wheels until the stubs are complete. Wheel-content validation now asserts that neither py.typed nor .pyi files are present, and wheel build scripts no longer request stub docstring injection while stubs are not installed.

Are these changes tested?

Wheel-content validation has been updated to check the intended absence of py.typed and .pyi files.

Are there any user-facing changes?

Type checkers no longer pick up pyarrow's incomplete stubs from wheels.

Copilot AI review requested due to automatic review settings June 14, 2026 19:11
@rok rok requested review from AlenkaF and raulcd as code owners June 14, 2026 19:11
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #49831 has been automatically assigned in GitHub to PR creator.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.typed via wheel.exclude.
  • Add explanatory comments documenting the rationale and removal TODO.

Comment thread python/pyproject.toml
Comment thread ci/scripts/python_wheel_validate_contents.py
Copilot AI review requested due to automatic review settings June 15, 2026 07:26
@github-actions github-actions Bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Jun 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

Comment thread ci/scripts/python_wheel_validate_contents.py Outdated
Comment thread python/CMakeLists.txt Outdated
Comment on lines +1044 to +1047
# TODO(GH-49831): Temporarily do not install pyarrow-stubs into wheels.
# The stubs are incomplete, and some type checkers consume .pyi files even
# without the py.typed marker. Re-enable this when the stubs are complete.
#

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might wanna look into this repo as a follow up 🎁

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooh, if this works we can get rid of quite some logic, thanks!

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah great - hope so too!

If it doesn't, it could still be worth opening an issue since it's being actively developed - they might just not have coverage for cython yet

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it and didn't get any docstrings of cythonic symbols, so I opened an issue astral-sh/docstring-adder#184.

Comment thread python/pyproject.toml

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@github-actions github-actions Bot added awaiting changes Awaiting changes and removed awaiting change review Awaiting change review labels Jun 15, 2026

@dangotbanned dangotbanned left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rok

AFAICT, this should unblock narwhals-dev/narwhals#3560

Probably best to have someone familiar with your build process look this over, but LGTM

Comment thread python/CMakeLists.txt Outdated
@rok rok force-pushed the broken-annotations-downstream branch from 1c4cec9 to fe246a4 Compare June 23, 2026 22:35
@github-actions github-actions Bot added awaiting change review Awaiting change review awaiting changes Awaiting changes and removed awaiting changes Awaiting changes awaiting change review Awaiting change review labels Jun 23, 2026
@rok rok changed the title GH-49831: [Python] Withhold py.typed from the wheel until stubs are complete GH-49831: [Python] Withhold annotations from Python wheel until they are complete Jun 23, 2026
@github-actions github-actions Bot added awaiting change review Awaiting change review awaiting changes Awaiting changes and removed awaiting changes Awaiting changes awaiting change review Awaiting change review labels Jun 23, 2026
@rok rok force-pushed the broken-annotations-downstream branch from 7cc87e4 to 245beff Compare June 24, 2026 00:13
@github-actions github-actions Bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Jun 24, 2026
@rok

rok commented Jun 24, 2026

Copy link
Copy Markdown
Member Author

@github-actions crossbow submit wheel-manylinux-2-28-cp311-cp311-amd64

@github-actions

Copy link
Copy Markdown

Revision: 245beff

Submitted crossbow builds: ursacomputing/crossbow @ actions-25b0103e6b

Task Status
wheel-manylinux-2-28-cp311-cp311-amd64 GitHub Actions

@rok rok force-pushed the broken-annotations-downstream branch from 245beff to 5483c2f Compare June 24, 2026 01:07
@rok

rok commented Jun 24, 2026

Copy link
Copy Markdown
Member Author

@github-actions crossbow submit wheel-manylinux-2-28-cp311-cp311-amd64

@github-actions

Copy link
Copy Markdown

Revision: 5483c2f

Submitted crossbow builds: ursacomputing/crossbow @ actions-27d8a83445

Task Status
wheel-manylinux-2-28-cp311-cp311-amd64 GitHub Actions

@rok

rok commented Jun 24, 2026

Copy link
Copy Markdown
Member Author

@dangotbanned @raulcd I think this is ready for review. Stubs remain in the repo, they are checked but they are not packed into the wheel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants