[db-dtypes] Support pandas 3.1 ExtensionArray compliance interface changes

オープン
#18,514 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
numpy, pandas, python

調査の方向性

Start with db_dtypes/dtypes.py and the compliance files tests/compliance/test_date_compliance.py, test_json_compliance.py, and test_time_compliance.py. Run nox -s unit_prerelease with pandas 3.1.0rc0, then inspect the failing ExtensionArray tests and the temporary constraint in packages/db-dtypes/testing/constraints-3.14.txt. Done means unit and compliance suites pass against pandas 3.1 and the temporary ceiling is removed.

索引モデルが issue の本文から書いたものです。

説明

Summary

When testing with pandas >= 3.1.0 (currently in pre-release on PyPI as pandas==3.1.0rc0), the db-dtypes compliance test suite (tests/compliance) fails due to upstream changes in pandas internal utilities and ExtensionArray interface contracts.

To prevent presubmit PR CI from failing unexpectedly on developer branches, a temporary ceiling constraint (pandas < 3.1.0dev0) was added in packages/db-dtypes/testing/constraints-3.14.txt. This issue tracks the feature work required to update db-dtypes for full pandas 3.1 compatibility.


Problem Details

1. Private Import Removal (np_version_gt2)

The compliance test files (test_date_compliance.py, test_json_compliance.py, test_time_compliance.py) currently import a private helper:

from pandas.compat.numpy import np_version_gt2

In pandas 3.1, this private attribute has been removed from pandas.compat.numpy, resulting in test collection errors:

ImportError: cannot import name 'np_version_gt2' from 'pandas.compat.numpy'
2. ExtensionArray Interface Contract Changes

Pandas 3.1 introduces stricter interface requirements in pandas.tests.extension.base:

  • fillna mapping: ExtensionArray.fillna() no longer accepts dictionary or mapping values.
  • Comparison Operator Outputs: Changes to boolean comparison return types and PyArrow-backed boolean handling.
  • Datetime / ZoneInfo fixture dependencies: Test fixtures generating localized timestamps require explicit tzdata resolution on newer Python runtimes.

Desired Solution

  1. Decouple Version Checks:
    Replace from pandas.compat.numpy import np_version_gt2 in tests/compliance/ with standard version checks using packaging.version.parse(np.__version__) >= Version("2.0.0").
  2. Update Array Implementations for Pandas 3.1:
    Audit and update DateArray, TimeArray, and JSONArray in db_dtypes/dtypes.py to satisfy both pandas 3.0 and pandas 3.1 ExtensionArray contracts simultaneously.
  3. Verify Pre-release & Compliance:
    Run both unit and compliance test suites against pandas>=3.1.0rc0 using nox -s unit_prerelease to ensure 100% compliance.
  4. Remove Temporary Constraint:
    Remove pandas < 3.1.0dev0 from packages/db-dtypes/testing/constraints-3.14.txt.
主要言語
Python
スター
5.4k
フォーク
1.8k
平均マージ
2日 20時間
マージ済み PR(30日)
140

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

googleapis/google-cloud-python のほかの issue

googleapis/google-cloud-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。