Skip to content

GH-32609: [Python] Add type annotations to PyArrow#47609

Draft
rok wants to merge 1 commit intoapache:mainfrom
rok:pyarrow-stubs-2
Draft

GH-32609: [Python] Add type annotations to PyArrow#47609
rok wants to merge 1 commit intoapache:mainfrom
rok:pyarrow-stubs-2

Conversation

@rok
Copy link
Member

@rok rok commented Sep 20, 2025

NOTE: This PR is currently being split into multiple smaller ones. DO NOT MERGE.

This proposes adding type annotation to pyarrow by adopting pyarrow-stubs into pyarrow. To do so we copy pyarrow-stubs's stubfiles into arrow/python/pyarrow-stubs/, restructure them somewhat and add more annotations. We remove docstrings from annotations and provide a script to include docstrings into stubfiles at wheel-build-time. We also remove overloads from annotations to simplify this PR. We then add annotation checks for all project files. We introduce a CI check to make sure all mypy, pyright and ty annotation checks pass (see python/pyproject.toml for any exceptions).

PR introduces:

  1. adds pyarrow-stubs into arrow/python/pyarrow-stubs/
  2. fixes pyarrow-stubs to pass ty, mypy and pyright check
  3. adds ty, mypy and pyright check to CI (crudely)
  4. adds a tool (update_stub_docstrings.py) to insert annotation docstrings into stubfiles at wheel-build-time

Loading
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