Skip to content

GH-49197: [Python][Annotations] Parquet and Dataset - #49204

Draft
rok wants to merge 31 commits into
apache:mainfrom
rok:pyarrow-stubs-pr7-parquet-dataset
Draft

rok wants to merge 31 commits into
apache:mainfrom
rok:pyarrow-stubs-pr7-parquet-dataset

Conversation

@rok

@rok rok commented Feb 9, 2026 •

Copy link
Copy Markdown
Member

Rationale for this change

Closes: #49197

What changes are included in this PR?

Add type annotation stubs for parquet (core, encryption) and dataset modules, including internal variants (_parquet, _dataset, _dataset_orc, _dataset_parquet, _dataset_parquet_encryption). Includes source fixes and type-ignore annotations in related tests.

Are these changes tested?

Yes, by CI.

Are there any user-facing changes?

Parquet and dataset modules will now be annotated.

@github-actions

github-actions Bot commented Feb 9, 2026

Copy link
Copy Markdown

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

tadeja and others added 26 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-pr7-parquet-dataset branch 2 times, most recently from 3582d1c to c86b4f4 Compare November 30, 2026 18:04
@rok
rok force-pushed the pyarrow-stubs-pr7-parquet-dataset branch from c86b4f4 to 76acaa7 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] Parquet and Dataset

4 participants