Registry / type-stubs / pyarrow-stubs

pyarrow-stubs

JSON →
library20.0.0.20260819pypypi✓ verified 26d ago

pyarrow-stubs provides type annotations for the Apache Arrow Python library (PyArrow). Its purpose is to enable static type checking tools like MyPy and Pyright to analyze code that uses PyArrow, improving code quality and catching potential errors at development time. The current version is 20.0.0.20251215, with releases typically aligning with PyArrow's development, and ongoing discussions about potentially integrating stubs directly into the main Apache Arrow project.

pip install pyarrow-stubs
INSTALL
IMPORT
SIG · PYARROW-STUBS
P
pyarrow-stubs
type-stubspythonv20.0.0.20260819
Install
3.4s avg
Import
70ms
Disk
183MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v20.0.0.20260819 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.072s · 203.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.4s · import 0.068s · 173MB
183MB installed
● package 183MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Table
import pyarrow as pa # Usage: pa.Table
Type annotations are automatically picked up by type checkers when 'pyarrow' is imported. You do not import directly from 'pyarrow-stubs'.
Array
import pyarrow as pa # Usage: pa.Array
Type annotations are automatically picked up by type checkers when 'pyarrow' is imported. You do not import directly from 'pyarrow-stubs'.

This example demonstrates creating a PyArrow Table with explicit type hints. When `pyarrow-stubs` is installed, a type checker like MyPy or Pyright will use these stubs to validate the types in your code, for example, ensuring that `create_arrow_table` returns a `pa.Table`.

import pyarrow as pa from typing import List def create_arrow_table(names: List[str], ages: List[int]) -> pa.Table: """Creates a PyArrow Table from names and ages.""" if not (len(names) == len(ages)): raise ValueError("Lengths of names and ages must match.") # Create PyArrow Arrays name_array = pa.array(names, type=pa.string()) age_array = pa.array(ages, type=pa.int64()) # Create a PyArrow Table table = pa.table({'name': name_array, 'age': age_array}) return table if __name__ == "__main__": my_names = ["Alice", "Bob", "Charlie"] my_ages = [30, 24, 35] # This call would be type-checked by tools like MyPy/Pyright person_table: pa.Table = create_arrow_table(my_names, my_ages) print("Created PyArrow Table:") print(person_table) print(f"\nFirst person's name: {person_table.column('name')[0].as_py()}")
Debug
Known issues
gotchaType checkers like MyPy and Pyright will report 'Stub file not found for "pyarrow"' or 'Skipping analyzing "pyarrow": module is installed, but missing library stubs or py.typed marker' if `pyarrow-stubs` is not installed alongside `pyarrow`. Ensure `pyarrow-stubs` is present in your environment for proper static analysis.
fix
Install `pyarrow-stubs` in the same environment as `pyarrow` using `pip install pyarrow-stubs`.
affects: All versions
gotchaDue to PyArrow's underlying C++/Cython implementation and dynamic nature, some parts of its API may have incomplete or less precise type hints within `pyarrow-stubs`. You might encounter situations where explicit type casting (`typing.cast`) or `typing.Any` is necessary, especially for complex or dynamically generated types. The PyArrow community is actively working on improving type coverage, including discussions about integrating stubs directly into the main project.
fix
For type errors, consider using `typing.cast` or `typing.Any` as a temporary workaround. Consult the `pyarrow` and `pyarrow-stubs` GitHub issues and discussions for the latest updates on type completeness.
affects: All versions
breakingA security vulnerability (CVE-2023-47248) in `pyarrow` related to `pyarrow.PyExtensionType` led to the `pyarrow-hotfix` package. If your code uses `pyarrow.PyExtensionType` (e.g., for custom extension types in Parquet files) and `pyarrow-hotfix` is active, your workloads might fail. The recommended fix is to migrate to `pyarrow.ExtensionType`.
fix
Migrate your code to use `pyarrow.ExtensionType` instead of `pyarrow.PyExtensionType`. Refer to the `pyarrow` documentation and security advisories for detailed migration steps.
affects: pyarrow < 14.0.1 (addressed by pyarrow-hotfix)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pyarrow'
The 'pyarrow' module is not installed in the Python environment.
fix
Install 'pyarrow' using pip: 'pip install pyarrow'.
ModuleNotFoundError: No module named 'pyarrow._dataset'
The 'pyarrow' installation is incomplete or lacks the 'dataset' module.
fix
Ensure 'pyarrow' is installed correctly, possibly by reinstalling: 'pip install --force-reinstall pyarrow'.
ModuleNotFoundError: No module named 'pyarrow.gandiva'
The 'pyarrow' installation is missing the 'gandiva' module.
fix
Reinstall 'pyarrow' ensuring all components are included: 'pip install --force-reinstall pyarrow'.
AttributeError: module 'pyarrow.fs' has no attribute 'S3FileSystem'
The 'pyarrow' installation lacks the 'S3FileSystem' attribute in the 'fs' module.
fix
Reinstall 'pyarrow' ensuring all components are included: 'pip install --force-reinstall pyarrow'.
Skipping analyzing "pyarrow": module is installed, but missing library stubs or py.typed marker
MyPy detected the 'pyarrow' module but could not find its associated type stubs ('pyarrow-stubs') or a 'py.typed' marker within the 'pyarrow' distribution itself, leading to unchecked types.
fix
Install the pyarrow-stubs package using pip: `pip install pyarrow-stubs`
Upgrade
Version history
20.0.0.20260819latest on PyPI · released Aug 19, 2026
Audit
Dependencies
pyarrowrequiredProvides the runtime library for which these stubs offer type annotations.
Agent activity
25 hits · last 30 days
node
18
OpenAI (training)
2
Amazon
1
Resources
pyarrow-stubs — pip install pyarrow-stubs · libregistry