Skip to content

GH-49198: [Python][Annotations] Flight, CUDA and other modules - #49205

Draft
rok wants to merge 32 commits into
apache:mainfrom
rok:pyarrow-stubs-pr8-leaf-modules
Draft

rok wants to merge 32 commits into
apache:mainfrom
rok:pyarrow-stubs-pr8-leaf-modules

Conversation

@rok

@rok rok commented Feb 9, 2026 •

Copy link
Copy Markdown
Member

Rationale for this change

Closes: #49198

What changes are included in this PR?

Add type annotation stubs for flight, cuda, interchange, gandiva, substrait, pandas_compat, pandas_shim, cffi, compat, and util modules. Includes source fixes and type-ignore annotations in related tests.

Are these changes tested?

Yes, by CI.

Are there any user-facing changes?

Above mentioned ,modules will now be annotated.

@github-actions

github-actions Bot commented Feb 9, 2026

Copy link
Copy Markdown

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

@tadeja

tadeja commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Note: Moved also compat.pyi and pandas_shim.pyi to subfolder __lib/ to use the same pattern as in #55264 (comment) ( commits eda3425 + fd19ff4 )

Future note: ‎python/pyarrow-stubs/pyarrow/lib.pyi‎ will need these two added as well:

from pyarrow.__lib.compat import *  # noqa: F401,F403
from pyarrow.__lib.pandas_shim import *  # noqa: F401,F403

tadeja and others added 24 commits November 30, 2026 18:17
Replace the scalar.pyi placeholder with annotations for Scalar, its
subclasses, NA and pyarrow.scalar(), following the conventions of the
other stubs: plain classes instead of generics, the class hierarchy of
the runtime (e.g. StringScalar is a BinaryScalar, the extension scalars
are ExtensionScalars, ListScalar is a Sequence and StructScalar a
Mapping), and concrete return types for as_py() and the value
properties.

Array and ChunkedArray now return real Scalar types from indexing,
iteration, sum() and index(), so a ChunkedArray is no longer accepted as
the mask of pyarrow.array(). Their __getitem__ gets two overloads, so
that an index returns a Scalar and a slice an array, instead of a union
of both. Add annotation tests for the scalars.
Annotate pyarrow.compute, pyarrow._compute, pyarrow._acero and
pyarrow._compute_docstrings, following the approach of apacheGH-55264: plain
classes and unions instead of generics, in the flat pyarrow-stubs/
layout.

- Array arguments accept any Array or ChunkedArray, since pa.array()
  and most of the API return plain Array instances. The return types
  name the kind of array where the function determines it. The scalar
  classes are placeholders (Any) until scalar.pyi is annotated.
- The signatures match the runtime, as checked by stubtest.
- pyarrow.compute and pyarrow._compute are type checked instead of
  being treated as Any.
- Add type annotation tests for the compute and Acero stubs.
@rok
rok force-pushed the pyarrow-stubs-pr8-leaf-modules branch 2 times, most recently from 14b3810 to afdeb4a Compare November 30, 2026 18:04
@rok
rok force-pushed the pyarrow-stubs-pr8-leaf-modules branch from afdeb4a to a31718e Compare November 30, 2026 18:14
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.

[Python][Annotations] Flight, CUDA and other modules

4 participants