Skip to content

Commit 5d57b25

Browse files
authored
fix(ci): fix docfx and db-dtypes pandas compat (#18512)
1 parent c38e960 commit 5d57b25

4 files changed

Lines changed: 46 additions & 4 deletions

File tree

‎packages/db-dtypes/docs/conf.py‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,6 @@
359359

360360
# Example configuration for intersphinx: refer to the Python standard library.
361361
intersphinx_mapping = {
362-
"python": ("https://python.readthedocs.org/en/latest/", None),
363362
"google-auth": ("https://googleapis.dev/python/google-auth/latest/", None),
364363
"google.api_core": (
365364
"https://googleapis.dev/python/google-api-core/latest/",
@@ -371,6 +370,21 @@
371370
"pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None),
372371
}
373372

373+
# Check reachability of the Python standard library inventory before attaching it.
374+
# Because Sphinx is run with `-W` (warnings as errors) in CI, an external network
375+
# failure or upstream outage on docs.python.org would otherwise treat the missing
376+
# inventory as a fatal error and fail the build.
377+
try:
378+
import urllib.request
379+
380+
with urllib.request.urlopen("https://docs.python.org/3/objects.inv", timeout=2):
381+
intersphinx_mapping["python"] = (
382+
"https://python.readthedocs.org/en/latest/",
383+
None,
384+
)
385+
except Exception:
386+
pass
387+
374388

375389
# Napoleon settings
376390
napoleon_google_docstring = True
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# When testing with `pandas >= 3.1.0` (currently in pre-release as `pandas==3.1.0rc0`),
2+
# the `db-dtypes` compliance test suite (`tests/compliance`) fails due to upstream
3+
# changes in pandas internal utilities and ExtensionArray interface contracts.
4+
# To prevent presubmit PR CI from failing unexpectedly on developer branches, a
5+
# temporary ceiling constraint (`pandas < 3.1.0dev0`) was added.
6+
#
7+
# Forward-looking tests against upcoming, unreleased versions of pandas and other
8+
# dependencies continue to run in our dedicated pre-release test suite.
9+
10+
pandas < 3.1.0dev0

‎packages/db-dtypes/tests/unit/test_dtypes.py‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,15 @@ def exercise_any():
534534
try:
535535
return a.any()
536536
except TypeError as e:
537-
if "does not support operation" in str(e) or "not supported" in str(e):
537+
# Truth reduction ('any'/'all') is disallowed on datetime64 arrays (pandas GH#34479).
538+
# Known messages across pandas versions:
539+
# - pandas < 3.0: "datetime64 type does not support operation 'any'"
540+
# - pandas >= 3.0: "'any' with datetime64 dtypes is not supported"
541+
# - test mock: "does not support operation"
542+
msg = str(e)
543+
if "does not support operation" in msg or (
544+
"datetime64" in msg and "is not supported" in msg
545+
):
538546
return
539547
raise e
540548

@@ -571,7 +579,15 @@ def exercise_all():
571579
try:
572580
return a.all()
573581
except TypeError as e:
574-
if "does not support operation" in str(e) or "not supported" in str(e):
582+
# Truth reduction ('any'/'all') is disallowed on datetime64 arrays (pandas GH#34479).
583+
# Known messages across pandas versions:
584+
# - pandas < 3.0: "datetime64 type does not support operation 'all'"
585+
# - pandas >= 3.0: "'all' with datetime64 dtypes is not supported"
586+
# - test mock: "does not support operation"
587+
msg = str(e)
588+
if "does not support operation" in msg or (
589+
"datetime64" in msg and "is not supported" in msg
590+
):
575591
return
576592
raise e
577593

‎packages/gcp-sphinx-docfx-yaml/noxfile.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,9 @@ def lint_setup_py(session):
171171
session.run("flake8", "setup.py")
172172

173173

174-
@nox.session(python=UNIT_TEST_PYTHON_VERSIONS)
174+
# Use virtualenv backend to prevent modern uv build isolation from failing on
175+
# legacy sdist dependencies (unify/untokenize)
176+
@nox.session(python=UNIT_TEST_PYTHON_VERSIONS, venv_backend="virtualenv")
175177
def unit(session):
176178
"""Run unit tests."""
177179
# Re-enable 3.11, 3.12, and 3.13 after environment verification.

0 commit comments

Comments
 (0)