Skip to content

Conversation

@rok
Copy link
Member

@rok rok commented Dec 22, 2025

Rationale for this change

This is the first in series of PRs adding type annotations to pyarrow and resolving #32609.

What changes are included in this PR?

This PR establishes infrastructure for type checking:

  • Adds CI workflow for running mypy, pyright, and ty type checkers on linux, macos and windows
  • Configures type checkers to validate stub files (excluding source files for now)
  • Adds PEP 561 py.typed marker to enable type checking
  • Updates wheel build scripts to include stub files in distributions
  • Creates initial minimal stub directory structure
  • Updates developer documentation with type checking workflow

Are these changes tested?

No. This is mostly a CI change.

Are there any user-facing changes?

This does not add any actual annotations (only py.typed marker) so user should not be affected.

…d script for including docstrings into stubfiles before building wheels.
Copy link
Member

@AlenkaF AlenkaF left a comment

Choose a reason for hiding this comment

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

Thank you @rok for working on this! Splitting up the main PR sounds like a great idea to me.

I only have one small question, otherwise the changes look good to me.

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Dec 23, 2025
@rok
Copy link
Member Author

rok commented Dec 23, 2025

Thanks for review @AlenkaF ! I think we probably want @raulcd to look at this too before merging?

@AlenkaF
Copy link
Member

AlenkaF commented Dec 23, 2025

Yes, let's wait for Raul 👍

@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 Dec 23, 2025
Copy link
Member

@raulcd raulcd left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @rok sorry it took me a while to review with holidays, release, etcetera

@raulcd
Copy link
Member

raulcd commented Jan 13, 2026

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

@github-actions
Copy link

Revision: 28fba3a

Submitted crossbow builds: ursacomputing/crossbow @ actions-8a459250fe

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

Co-authored-by: Raúl Cumplido <[email protected]>
@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Jan 14, 2026
@github-actions github-actions bot removed the awaiting change review Awaiting change review label Jan 14, 2026
@rok
Copy link
Member Author

rok commented Jan 14, 2026

Thanks for review @raulcd ! I've responded to your points.

ARROW_S3: "OFF"
ARROW_SUBSTRAIT: "OFF"
ARROW_WITH_OPENTELEMETRY: "OFF"
PYARROW_TEST_ANNOTATIONS: "ON"
Copy link
Member

Choose a reason for hiding this comment

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

I think is worth it if instead of using a separate ci/scripts/python_test_type_annotations.sh we use ci/scripts/python_test.sh and we use the PYARROW_TEST_ANNOTATIONS variable to manage whether we want annotations to be tested or not as part of python testing.
If we decide we want to have two separate scripts I think this env var should be removed.
I lean towards having a single python test script that can allow us to also test annotations but I can find arguments for both so not an issue.

Comment on lines 178 to 181
# We first populate stub docstrings and then build the wheel
python setup.py build_ext --inplace
python -m pip install griffe libcst
python ../dev/update_stub_docstrings.py pyarrow-stubs
Copy link
Member

Choose a reason for hiding this comment

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

this is not necessary, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Same as #48618 (comment). It's a noop and we don't have to introduce python logic in stub PRs if we do here.

Comment on lines 138 to 140
@REM We first populate stub docstrings and then build the wheel
%PYTHON_CMD% setup.py build_ext --inplace
%PYTHON_CMD% -m pip install griffe libcst
Copy link
Member

Choose a reason for hiding this comment

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

Until we have real annotations this isn't necessary, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

I added running dev\update_stub_docstrings.py, so I suppose it's a noop now and we can keep it to make sure it doesn't fail before introducing actual stubs? This will keep CI logic out of stub PRs.

@rok rok changed the title GH-32609: [CI] Add type checking infrastructure and CI workflow for type annotions GH-32609: [CI] Add type checking infrastructure and CI workflow for type annotations Jan 14, 2026
@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Jan 14, 2026
@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting change review Awaiting change review labels Jan 14, 2026
@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Jan 14, 2026
@rok
Copy link
Member Author

rok commented Jan 14, 2026

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

@github-actions
Copy link

Revision: ee72560

Submitted crossbow builds: ursacomputing/crossbow @ actions-cd0acc6696

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

@rok
Copy link
Member Author

rok commented Jan 14, 2026

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

@github-actions
Copy link

Revision: 19b54bc

Submitted crossbow builds: ursacomputing/crossbow @ actions-f406282276

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

@rok
Copy link
Member Author

rok commented Jan 14, 2026

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

@github-actions
Copy link

Revision: c23cb9c

Submitted crossbow builds: ursacomputing/crossbow @ actions-286c26b719

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

@rok
Copy link
Member Author

rok commented Jan 14, 2026

@raulcd I've factored out griffe and click, but we still need libcst (using ast would not provide stable syntax here). I think wheel builds should now pass. Please take another look when you have time.

@rok rok requested a review from raulcd January 14, 2026 17:48
@rok
Copy link
Member Author

rok commented Jan 14, 2026

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

@github-actions
Copy link

Revision: 491ff2c

Submitted crossbow builds: ursacomputing/crossbow @ actions-b6331706da

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

change bat
lint
add a popd and nicer logging for windows
ReplaceElipsis -> DocstringInserter
simplify
remove sphinx
@rok
Copy link
Member Author

rok commented Jan 14, 2026

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

@github-actions
Copy link

Revision: ba07ac8

Submitted crossbow builds: ursacomputing/crossbow @ actions-6c5a9f1e7e

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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants