Skip to content

Commit 943af28

Browse files
committed
Merge branch 'fix/_iter_chunk_keys' of github.com:d-v-b/zarr-python into fix/_iter_chunk_keys
2 parents 5c34e4a + a258780 commit 943af28

File tree

9 files changed

+81
-10
lines changed

9 files changed

+81
-10
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Check changelog entries
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
check-changelogs:
8+
name: Check changelog entries
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
13+
14+
- name: Install uv
15+
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
16+
17+
- name: Check changelog entries
18+
run: uv run --no-sync python ci/check_changelog_entries.py
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

ci/check_changelog_entries.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
"""
2+
Check changelog entries have the correct filename structure.
3+
"""
4+
5+
import sys
6+
from pathlib import Path
7+
8+
VALID_CHANGELOG_TYPES = ["feature", "bugfix", "doc", "removal", "misc"]
9+
CHANGELOG_DIRECTORY = (Path(__file__).parent.parent / "changes").resolve()
10+
11+
12+
def is_int(s: str) -> bool:
13+
try:
14+
int(s)
15+
except ValueError:
16+
return False
17+
else:
18+
return True
19+
20+
21+
if __name__ == "__main__":
22+
print(f"Looking for changelog entries in {CHANGELOG_DIRECTORY}")
23+
entries = CHANGELOG_DIRECTORY.glob("*")
24+
entries = [e for e in entries if e.name not in [".gitignore", "README.md"]]
25+
print(f"Found {len(entries)} entries")
26+
print()
27+
28+
bad_suffix = [e for e in entries if e.suffix != ".rst"]
29+
bad_issue_no = [e for e in entries if not is_int(e.name.split(".")[0])]
30+
bad_type = [e for e in entries if e.name.split(".")[1] not in VALID_CHANGELOG_TYPES]
31+
32+
if len(bad_suffix) or len(bad_issue_no) or len(bad_type):
33+
if len(bad_suffix):
34+
print("Changelog entries without .rst suffix")
35+
print("-------------------------------------")
36+
print("\n".join([p.name for p in bad_suffix]))
37+
print()
38+
if len(bad_issue_no):
39+
print("Changelog entries without integer issue number")
40+
print("----------------------------------------------")
41+
print("\n".join([p.name for p in bad_issue_no]))
42+
print()
43+
if len(bad_type):
44+
print("Changelog entries without valid type")
45+
print("------------------------------------")
46+
print("\n".join([p.name for p in bad_type]))
47+
print(f"Valid types are: {VALID_CHANGELOG_TYPES}")
48+
print()
49+
sys.exit(1)
50+
51+
sys.exit(0)

pyproject.toml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ gpu = [
7070
]
7171
# Development extras
7272
test = [
73-
"coverage",
73+
"coverage>=7.10",
7474
# Pin possibly due to https://github.com/pytest-dev/pytest-cov/issues/693
7575
"pytest<8.4",
7676
"pytest-asyncio",
@@ -128,11 +128,8 @@ dev = [
128128
]
129129

130130
[tool.coverage.report]
131-
exclude_lines = [
132-
"pragma: no cover",
133-
"if TYPE_CHECKING:",
134-
"pragma: ${PY_MAJOR_VERSION} no cover",
135-
'.*\.\.\.' # Ignore "..." lines
131+
exclude_also = [
132+
'if TYPE_CHECKING:',
136133
]
137134

138135
[tool.coverage.run]

src/zarr/dtype.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
VariableLengthUTF8JSON_V2,
3939
ZDType,
4040
data_type_registry,
41+
# Import for backwards compatibility, but not included in __all__
42+
# so it doesn't show up in the docs
43+
parse_data_type, # noqa: F401
4144
parse_dtype,
4245
)
4346

tests/test_dtype_registry.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,20 @@
1313
from zarr.core.config import config
1414
from zarr.core.dtype import (
1515
AnyDType,
16-
Bool,
1716
DataTypeRegistry,
18-
FixedLengthUTF32,
1917
TBaseDType,
2018
TBaseScalar,
19+
get_data_type_from_json,
20+
)
21+
from zarr.core.dtype.common import unpack_dtype_json
22+
from zarr.dtype import ( # type: ignore[attr-defined]
23+
Bool,
24+
FixedLengthUTF32,
2125
ZDType,
2226
data_type_registry,
23-
get_data_type_from_json,
2427
parse_data_type,
2528
parse_dtype,
2629
)
27-
from zarr.core.dtype.common import unpack_dtype_json
2830

2931
if TYPE_CHECKING:
3032
from collections.abc import Generator

0 commit comments

Comments
 (0)