Skip to content

Commit c90c9a0

Browse files
d-v-bclaude
andcommitted
build(metadata): lower minimum Python to 3.11
zarr-metadata is a typing-only foundational package consumed by libraries; supporting one Python version below the current minimum widens the audience at minimal cost. The only blocker was PEP 695 generic class syntax in `common.py`: class NamedConfig[TName: str, TConfig: ...](TypedDict): Rewritten to the PEP 484 `Generic[T]` form, which works on 3.11+. The two affected classes carry `# noqa: UP046` comments since the ruff rule pushes toward the newer syntax that we deliberately avoid. All other modern features (PEP 604 `X | Y` unions at runtime, `NotRequired`, `extra_items=` via typing_extensions, `ReadOnly`) already work on 3.11. Verified: package imports and all 6 tests pass on Python 3.11. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c6fcde9 commit c90c9a0

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

packages/zarr-metadata/pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "zarr-metadata"
77
version = "0.1.0"
88
description = "Spec-defined metadata types for Zarr v2 and v3."
99
readme = "README.md"
10-
requires-python = ">=3.12"
10+
requires-python = ">=3.11"
1111
license = "MIT"
1212
authors = [
1313
{ name = "Davis Bennett", email = "davis.v.bennett@gmail.com" },
@@ -18,6 +18,7 @@ classifiers = [
1818
"License :: OSI Approved :: MIT License",
1919
"Programming Language :: Python",
2020
"Programming Language :: Python :: 3",
21+
"Programming Language :: Python :: 3.11",
2122
"Programming Language :: Python :: 3.12",
2223
"Programming Language :: Python :: 3.13",
2324
"Programming Language :: Python :: 3.14",
@@ -47,4 +48,4 @@ checks = [
4748
include = ["src"]
4849
enableExperimentalFeatures = true
4950
typeCheckingMode = "strict"
50-
pythonVersion = "3.12"
51+
pythonVersion = "3.11"

packages/zarr-metadata/src/zarr_metadata/common.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,40 @@
77
"""
88

99
from collections.abc import Mapping, Sequence
10-
from typing import NotRequired, TypedDict
10+
from typing import Generic, NotRequired, TypedDict, TypeVar
1111

1212
from typing_extensions import ReadOnly
1313

1414
JSON = str | int | float | bool | Mapping[str, "JSON"] | Sequence["JSON"] | None
1515
"""Any valid JSON value."""
1616

1717

18-
class NamedConfig[TName: str, TConfig: Mapping[str, object]](TypedDict):
18+
TName = TypeVar("TName", bound=str)
19+
TConfig = TypeVar("TConfig", bound=Mapping[str, object])
20+
21+
22+
class NamedConfig(TypedDict, Generic[TName, TConfig]): # noqa: UP046
1923
"""
2024
Named-config envelope with optional configuration.
2125
2226
Generic with two parameters: name literal and configuration mapping.
27+
28+
Uses the PEP 484 ``Generic[T]`` form rather than PEP 695 ``[T]`` syntax
29+
so the package supports Python 3.11.
2330
"""
2431

2532
name: ReadOnly[TName]
2633
configuration: NotRequired[ReadOnly[TConfig]]
2734

2835

29-
class NamedRequiredConfig[TName: str, TConfig: Mapping[str, object]](TypedDict):
36+
class NamedRequiredConfig(TypedDict, Generic[TName, TConfig]): # noqa: UP046
3037
"""
3138
Named-config envelope with required configuration.
3239
3340
Generic with two parameters: name literal and configuration mapping.
41+
42+
Uses the PEP 484 ``Generic[T]`` form rather than PEP 695 ``[T]`` syntax
43+
so the package supports Python 3.11.
3444
"""
3545

3646
name: ReadOnly[TName]

0 commit comments

Comments
 (0)