Skip to content

Commit acca070

Browse files
committed
Enable some stricter typing rules
1 parent 6c0ea0f commit acca070

File tree

2 files changed

+41
-56
lines changed

2 files changed

+41
-56
lines changed

numcodecs/checksum32.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
_crc32c: Optional[ModuleType] = None
1515
with suppress(ImportError):
16-
import crc32c as _crc32c # type: ignore[no-redef]
16+
import crc32c as _crc32c # type: ignore[no-redef, unused-ignore]
1717

1818
if TYPE_CHECKING: # pragma: no cover
1919
from typing_extensions import Buffer

pyproject.toml

Lines changed: 40 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,10 @@ name = "numcodecs"
1313
description = """
1414
A Python package providing buffer compression and transformation codecs \
1515
for use in data storage and communication applications."""
16-
readme = "README.rst"
17-
dependencies = [
18-
"numpy>=1.24",
19-
"deprecated"
20-
]
16+
readme = "README.rst"
17+
dependencies = ["numpy>=1.24", "deprecated"]
2118
requires-python = ">=3.11"
22-
dynamic = [
23-
"version",
24-
]
19+
dynamic = ["version"]
2520
classifiers = [
2621
"Development Status :: 4 - Beta",
2722
"Intended Audience :: Developers",
@@ -34,9 +29,7 @@ classifiers = [
3429
"Programming Language :: Python :: 3",
3530
"Programming Language :: Python :: 3 :: Only",
3631
]
37-
maintainers = [
38-
{ name = "Alistair Miles", email = "alimanfoo@googlemail.com" },
39-
]
32+
maintainers = [{ name = "Alistair Miles", email = "alimanfoo@googlemail.com" }]
4033
license = { text = "MIT" }
4134

4235
[project.urls]
@@ -46,32 +39,13 @@ Documentation = "https://numcodecs.readthedocs.io/"
4639
Homepage = "https://github.com/zarr-developers/numcodecs"
4740

4841
[project.optional-dependencies]
49-
docs = [
50-
"sphinx",
51-
"sphinx-issues",
52-
"pydata-sphinx-theme",
53-
"numpydoc",
54-
]
55-
test = [
56-
"coverage",
57-
"pytest",
58-
"pytest-cov",
59-
]
60-
test_extras = [
61-
"importlib_metadata",
62-
]
63-
msgpack = [
64-
"msgpack",
65-
]
66-
zfpy = [
67-
"zfpy>=1.0.0"
68-
]
69-
pcodec = [
70-
"pcodec>=0.3,<0.4",
71-
]
72-
crc32c = [
73-
"crc32c>=2.7",
74-
]
42+
docs = ["sphinx", "sphinx-issues", "pydata-sphinx-theme", "numpydoc"]
43+
test = ["coverage", "pytest", "pytest-cov"]
44+
test_extras = ["importlib_metadata"]
45+
msgpack = ["msgpack"]
46+
zfpy = ["zfpy>=1.0.0"]
47+
pcodec = ["pcodec>=0.3,<0.4"]
48+
crc32c = ["crc32c>=2.7"]
7549

7650
[project.entry-points."zarr.codecs"]
7751
"numcodecs.blosc" = "numcodecs.zarr3:Blosc"
@@ -98,14 +72,14 @@ crc32c = [
9872

9973
[tool.setuptools]
10074
license-files = ["LICENSE.txt"]
101-
package-dir = {"" = "."}
75+
package-dir = { "" = "." }
10276
packages = ["numcodecs", "numcodecs.tests"]
10377
zip-safe = false
10478

10579
[tool.setuptools.package-data]
10680
numcodecs = [
10781
"tests/package_with_entrypoint/__init__.py",
108-
"tests/package_with_entrypoint-0.1.dist-info/entry_points.txt"
82+
"tests/package_with_entrypoint-0.1.dist-info/entry_points.txt",
10983
]
11084

11185
[tool.setuptools_scm]
@@ -118,13 +92,25 @@ skip = "./.git,fixture"
11892
ignore-words-list = "ba, compiletime, hist, nd, unparseable"
11993

12094
[tool.coverage.report]
121-
exclude_lines = [
122-
"pragma: no cover",
123-
"pragma: ${PY_MAJOR_VERSION} no cover",
124-
]
95+
exclude_lines = ["pragma: no cover", "pragma: ${PY_MAJOR_VERSION} no cover"]
12596

12697
[tool.repo-review]
127-
ignore = ["PY005", "PY007", "PP302", "PP308", "PP309", "GH103", "GH212", "PC111", "PC140", "PC160", "PC170", "PC180", "MY100", "RF103"]
98+
ignore = [
99+
"PY005",
100+
"PY007",
101+
"PP302",
102+
"PP308",
103+
"PP309",
104+
"GH103",
105+
"GH212",
106+
"PC111",
107+
"PC140",
108+
"PC160",
109+
"PC170",
110+
"PC180",
111+
"MY100",
112+
"RF103",
113+
]
128114

129115
[tool.pytest.ini_options]
130116
addopts = "-ra --strict-config --strict-markers --cov=numcodecs --cov-report xml --doctest-modules --doctest-glob=*.pyx"
@@ -133,9 +119,7 @@ doctest_optionflags = [
133119
"ELLIPSIS",
134120
"IGNORE_EXCEPTION_DETAIL",
135121
]
136-
testpaths = [
137-
"numcodecs/tests",
138-
]
122+
testpaths = ["numcodecs/tests"]
139123
norecursedirs = [
140124
".git",
141125
".github",
@@ -150,17 +134,15 @@ norecursedirs = [
150134
]
151135
log_cli_level = "INFO"
152136
xfail_strict = true
153-
filterwarnings = [
154-
"error",
155-
]
137+
filterwarnings = ["error"]
156138

157139
[tool.cibuildwheel]
158-
environment = { DISABLE_NUMCODECS_AVX2=1 }
140+
environment = { DISABLE_NUMCODECS_AVX2 = 1 }
159141
[tool.cibuildwheel.macos]
160-
environment = { MACOSX_DEPLOYMENT_TARGET=10.9, DISABLE_NUMCODECS_AVX2=1, CFLAGS="$CFLAGS -Wno-implicit-function-declaration" }
142+
environment = { MACOSX_DEPLOYMENT_TARGET = 10.9, DISABLE_NUMCODECS_AVX2 = 1, CFLAGS = "$CFLAGS -Wno-implicit-function-declaration" }
161143
[[tool.cibuildwheel.overrides]]
162144
select = "*-macosx_arm64"
163-
environment = { DISABLE_NUMCODECS_AVX2=1, DISABLE_NUMCODECS_SSE2=1 }
145+
environment = { DISABLE_NUMCODECS_AVX2 = 1, DISABLE_NUMCODECS_SSE2 = 1 }
164146

165147
[tool.ruff]
166148
line-length = 100
@@ -205,7 +187,7 @@ ignore = [
205187
"TRY003",
206188
"TRY301",
207189
"UP007",
208-
"UP038", # https://github.com/astral-sh/ruff/issues/7871
190+
"UP038", # https://github.com/astral-sh/ruff/issues/7871
209191
# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
210192
"W191",
211193
"E111",
@@ -225,7 +207,7 @@ ignore = [
225207

226208
[tool.ruff.lint.extend-per-file-ignores]
227209
"numcodecs/tests/**" = ["SIM201", "SIM202", "SIM300", "TRY002"]
228-
"notebooks/**" = ["W391"] # https://github.com/astral-sh/ruff/issues/13763
210+
"notebooks/**" = ["W391"] # https://github.com/astral-sh/ruff/issues/13763
229211

230212
[tool.ruff.format]
231213
quote-style = "preserve"
@@ -237,3 +219,6 @@ enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
237219
# TODO: set options below to true
238220
strict = false
239221
warn_unreachable = false
222+
warn_redundant_casts = true
223+
warn_unused_ignores = true
224+
warn_unused_configs = true

0 commit comments

Comments
 (0)