Fix test collection and mypy under zarr 3.2.x#171
Merged
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
d-v-b
added a commit
to d-v-b/pydantic-zarr
that referenced
this pull request
Jun 15, 2026
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
d-v-b
added a commit
to d-v-b/pydantic-zarr
that referenced
this pull request
Jun 15, 2026
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
d-v-b
added a commit
that referenced
this pull request
Jun 19, 2026
…ported) (#167) * Fix unreachable match arms in parse_dtype_v3 (float64/complex64) Two match arms in `parse_dtype_v3` (in both `pydantic_zarr.v3` and `pydantic_zarr.experimental.v3`) were copy-paste errors: the third arm used `Float16DType` instead of `Float64DType`, and the fourth used `Float32DType` instead of `Complex64DType`. This made `float64` and `complex64` dtypes unreachable, causing `ValueError: Unsupported dtype` for those types. Fixes part of #165. Also fixes the test conftest to handle zarr 3.2.1's new `Struct` dtype class (a subclass of `Structured`) by using `issubclass` instead of `==` in the special-case branch, and bumps the mypy `python_version` to 3.12 to match zarr >=3.2.0's minimum Python requirement. Adds parametrized regression tests covering all 13 supported numpy dtypes through `parse_dtype_v3` in both test suites. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Add changelog fragment for PR #167 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Move zarr 3.2.x compat changes to dedicated PR #171 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * make tests pass * import struct under conditional * robust import * pin pytest and fix iterator issue in test fixtures --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
d-v-b
added a commit
that referenced
this pull request
Jun 19, 2026
…mp (#169) * Fix NameError in v3 from_zarr/ArraySpec.like and KeyError in model_dump - ArraySpec.like in v3.py used bare `isinstance(other, zarr.Array)` with zarr only imported under TYPE_CHECKING, causing NameError at runtime; switch to the sys.modules guard already used by GroupSpec.like. - Module-level from_zarr in v3.py and experimental/v3.py referenced zarr.Array with no runtime import; add `import zarr` inside the function body (mirrors v2.py). - ArraySpec.model_dump in both v3.py and experimental/v3.py did d["dimension_names"] unconditionally, raising KeyError when dimension_names was excluded via model_dump(exclude={...}); use d.get() + pop(key, None). - Fix conftest.py for zarr 3.2 compatibility: Structured was renamed to Struct and requires fields; detect whichever name is present in the registry. - Bump mypy python_version from 3.11 to 3.12 so mypy can parse zarr 3.2 which uses the PEP 695 `type` statement syntax. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Add towncrier fragment for PR #169 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Move zarr 3.2.x compat changes to dedicated PR #171 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
… into fix/zarr-3.2-test-compat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes test-suite collection and type-checking under zarr-python 3.2.x. Part of #165.
zarr-python's CI matrix here pins
zarrto3.0.10/3.1.0, which hides two breakages that occur the moment a user installs the currentzarr(3.2.x):Test collection crashes. zarr 3.2 added a
Structdtype that subclassesStructuredand is registered separately.conftest.pydid an exactdtype_cls == Structuredcheck, so the newStructclass fell through to theelsebranch and was instantiated with nofields=argument, raisingTypeErrorat import time and aborting the whole suite. Changed toissubclass(dtype_cls, Structured).mypy can't parse zarr 3.2. zarr 3.2 uses PEP 695
type X = ...statements, which mypy rejects underpython_version = "3.11". Bumped the mypy target to3.12. (The package still supports 3.11 at runtime — this only affects the type-check target.)This does not add zarr 3.2 to the CI matrix: full 3.2.x support also needs to address ~187 API-deprecation test failures, which is a larger separate effort. This PR just stops a 3.2.x install from breaking collection and type-checking outright.
🤖 Generated with Claude Code