Skip to content

chore!: require Python >=3.10; remove deprecated NWIS_Metadata.variable_info (1.2.0)#332

Merged
thodson-usgs merged 1 commit into
DOI-USGS:mainfrom
thodson-usgs:chore/require-python-310
Jun 24, 2026
Merged

chore!: require Python >=3.10; remove deprecated NWIS_Metadata.variable_info (1.2.0)#332
thodson-usgs merged 1 commit into
DOI-USGS:mainfrom
thodson-usgs:chore/require-python-310

Conversation

@thodson-usgs

Copy link
Copy Markdown
Collaborator

Two breaking changes for the 1.2.0 release.

1. Require Python >=3.10

3.9 support was already effectively broken — the manifest just claimed otherwise:

  • waterdata's anyio dependency and the test stack (pytest-httpx) require 3.10+, and the waterdata test modules already skip on <3.10, so the CI 3.9 leg was a hollow shell (the flagship module untested).
  • Newer mypy can't even type-check at python_version = "3.9" because anyio's source uses 3.10 syntax (the mypy<2 pin existed only to keep targeting 3.9).

Changes:

  • requires-python = ">=3.10"; ruff target-version = "py310"; mypy python_version = "3.10"; relax mypy<2mypy.
  • Declare anyio>=4.0 as a direct dependency (it's imported directly by waterdata via start_blocking_portal; previously only transitive through httpx).
  • CI test matrix ["3.9", "3.13", "3.14"]["3.10", "3.13", "3.14"].
  • Trove classifiers filled in (per-version 3.10–3.14, dev-status, audience, topic).
  • The py310 ruff target newly enables B905; added explicit strict=False to the four pre-existing zip() calls (nwis, waterdata/chunking, waterdata/nearest) — identical to the prior implicit behavior, no semantic change.

2. Remove deprecated NWIS_Metadata.variable_info

It only emitted a DeprecationWarning and returned None (it relied on the defunct get_pmcodes). Accessing it now raises NotImplementedError via the utils.BaseMetadata abstract contract — the only deprecation cleanly removable now (the active nwis getters stay until their announced 2027-05-06 date). Drops the obsolete unit test; the BaseMetadata abstract property is kept.

Breaking changes

  • Python 3.9 is no longer supported; pip install dataretrieval>=1.2.0 requires Python >=3.10.
  • NWIS_Metadata.variable_info is removed (it always returned None).

Verification

  • ruff check / ruff format --check clean; mypy --strict dataretrieval/ clean at python_version = 3.10 (the bump also resolves the anyio parse fragility newer mypy hits at 3.9).
  • 152 offline tests pass across the touched files (nwis, utils, waterdata/chunking).

Part of a small set of 1.2.0 breaking-prep PRs (nadp/samples removal #330; get_samples snake_case #331).

🤖 Generated with Claude Code

@thodson-usgs thodson-usgs force-pushed the chore/require-python-310 branch from ffe2059 to ff7fcbb Compare June 24, 2026 14:55
…tadata property

Ahead of the breaking 1.2.0 release.

Require Python >=3.10
- 3.9 support was already effectively broken: `waterdata`'s `anyio` dependency
  and the test stack require 3.10+, and the `waterdata` test modules already
  skipped on <3.10. `requires-python = ">=3.10"`; ruff `target-version = "py310"`;
  mypy `python_version = "3.10"` (drops the `mypy<2` pin that only existed to keep
  targeting 3.9); declare `anyio>=4.0` as a direct dependency (imported directly
  by `waterdata`); CI matrix `["3.10", "3.13", "3.14"]`; fill in per-version Trove
  classifiers.
- The py310 ruff target newly enables `B905` (zip `strict=`) and `UP036`
  (now-dead `sys.version_info < (3, 10)` skip guards): add explicit `strict=False`
  to the remaining `zip()` calls (`nwis`, `ogc/planning`, `waterdata/nearest`) and
  drop the dead version-skip guards in the four `waterdata` test modules.
  Behavior-identical.

Remove the deprecated `variable_info` metadata property entirely
- The `NWIS_Metadata` override only warned and returned `None` (it relied on the
  defunct `get_pmcodes`). Nothing else implemented it, so the `BaseMetadata`
  abstract is removed too — accessing `.variable_info` now raises `AttributeError`.
- `site_info` is kept: `NWIS_Metadata`/`WQP_Metadata` implement it, and the modern
  `waterdata` metadata intentionally leaves it abstract (use
  `waterdata.get_monitoring_locations()` for site descriptions).

Fix the live-API flaky-rerun marker
- A live test that hits an SSL/connection timeout surfaces as a typed
  `NetworkError`, but the `flaky_api` rerun patterns matched only the raw httpx
  exception names. `pytest-rerunfailures` matches the crash line (the
  `NetworkError`), not the chained `ConnectTimeout`, so the transient was never
  retried and failed CI. Add `NetworkError` to `_TRANSIENT_RERUN_PATTERNS`.

BREAKING CHANGE: Python 3.9 is no longer supported; `pip install
dataretrieval>=1.2.0` requires Python >=3.10. The `variable_info` metadata
property is removed (it always returned `None`); use `site_info` or
`waterdata.get_monitoring_locations()`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sjb14HkwuCydKSKMsaXsgd
@thodson-usgs thodson-usgs force-pushed the chore/require-python-310 branch from ff7fcbb to 39fe73f Compare June 24, 2026 15:08
@thodson-usgs thodson-usgs marked this pull request as ready for review June 24, 2026 15:31
@thodson-usgs thodson-usgs merged commit af9b238 into DOI-USGS:main Jun 24, 2026
9 checks passed
@thodson-usgs thodson-usgs deleted the chore/require-python-310 branch June 24, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant