Add support for PEP 661 (sentinels)#21647
Open
edgarrmondragon wants to merge 12 commits into
Open
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
This comment has been minimized.
This comment has been minimized.
This was referenced Jun 26, 2026
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
This comment has been minimized.
This comment has been minimized.
Contributor
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
5 tasks
d-v-b
added a commit
to d-v-b/zarr-python
that referenced
this pull request
Jul 5, 2026
d-v-b's call: PEP 661 is Final, ty already types the sentinel spelling exactly, mypy support is in review (python/mypy#21647) and treated as imminent, and pyright has a known-good version — so use the standard sentinel today rather than carrying the enum stopgap. - UNSET is now typing_extensions.Sentinel("UNSET"), used directly in type expressions (tuple[str | None, ...] | UNSET); the UnsetType companion enum is gone from the API. - typing_extensions floor bumped to 4.14 (where Sentinel arrived). - CI pins pyright==1.1.404, the last version before the class-attribute sentinel regression (microsoft/pyright#11115); pyproject documents the same pin for local runs. 0 errors on the pin; ty checks the sentinel fields clean (its 2 remaining diagnostics are its incomplete PEP 728 extra_items write support, unrelated). - Known short-term cost, accepted deliberately: mypy-checked consumers need cast/type-ignore at narrowing sites until mypy#21647 merges, and contributors' Pylance may show phantom Unknowns until the pyright fix ships. Recorded in _sentinel.py and the changelog. - The pydantic native-introspection test reverts to documenting that introspection is unsupported (pydantic 2.13 cannot schema a Sentinel); the delegation patterns are unaffected. Assisted-by: ClaudeCode:claude-fable-5
d-v-b
added a commit
to d-v-b/zarr-python
that referenced
this pull request
Jul 8, 2026
The zarr-metadata model layer that zarr now depends on is unreleased, and
the previous wiring only covered uv project flows, breaking everything else:
- The floor 'zarr-metadata>=0.4.0' is unresolvable from PyPI (only <0.4.0
exists), failing every hatch env (test matrix, doctests, benchmarks,
hypothesis, min_deps, upstream) and the readthedocs build. The floor now
names the newest release (>=0.3) with a TODO to bump at release time, and
each non-uv flow installs the in-tree package explicitly: hatch envs get a
'{root:uri}/packages/zarr-metadata' direct reference (repeated per env,
since hatch replaces extra-dependencies on inheritance), readthedocs gets
an extra pip install step.
- uv workspace membership made 'uv sync' inside packages/zarr-metadata
resolve the whole workspace, dragging zarr's requires-python (>=3.12) into
the subpackage's own CI, which tests down to 3.11. The workspace is now a
plain editable path source, restoring the subpackage's independence.
- min_deps pins typing_extensions==4.16.* (was 4.14.*): 4.16 is the
effective minimum because zarr-metadata requires it for sentinel pickling.
Also fixes the Lint (mypy) findings in the new tests — a bare generic Array
annotation, stale type-ignores, and two sentinel comparisons mypy cannot
narrow (python/mypy#21647) — and renames the changelog entries to the PR
number (4129) required by the changelog check.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
See PEP 661 and python/typing#2277