Skip to content

Commit

Permalink
Enable some stricter typing rules
Browse files Browse the repository at this point in the history
  • Loading branch information
dstansby committed Jan 5, 2025
1 parent 6c0ea0f commit acca070
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 56 deletions.
2 changes: 1 addition & 1 deletion numcodecs/checksum32.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

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

if TYPE_CHECKING: # pragma: no cover
from typing_extensions import Buffer
Expand Down
95 changes: 40 additions & 55 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,10 @@ name = "numcodecs"
description = """
A Python package providing buffer compression and transformation codecs \
for use in data storage and communication applications."""
readme = "README.rst"
dependencies = [
"numpy>=1.24",
"deprecated"
]
readme = "README.rst"
dependencies = ["numpy>=1.24", "deprecated"]
requires-python = ">=3.11"
dynamic = [
"version",
]
dynamic = ["version"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
Expand All @@ -34,9 +29,7 @@ classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
]
maintainers = [
{ name = "Alistair Miles", email = "alimanfoo@googlemail.com" },
]
maintainers = [{ name = "Alistair Miles", email = "alimanfoo@googlemail.com" }]
license = { text = "MIT" }

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

[project.optional-dependencies]
docs = [
"sphinx",
"sphinx-issues",
"pydata-sphinx-theme",
"numpydoc",
]
test = [
"coverage",
"pytest",
"pytest-cov",
]
test_extras = [
"importlib_metadata",
]
msgpack = [
"msgpack",
]
zfpy = [
"zfpy>=1.0.0"
]
pcodec = [
"pcodec>=0.3,<0.4",
]
crc32c = [
"crc32c>=2.7",
]
docs = ["sphinx", "sphinx-issues", "pydata-sphinx-theme", "numpydoc"]
test = ["coverage", "pytest", "pytest-cov"]
test_extras = ["importlib_metadata"]
msgpack = ["msgpack"]
zfpy = ["zfpy>=1.0.0"]
pcodec = ["pcodec>=0.3,<0.4"]
crc32c = ["crc32c>=2.7"]

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

[tool.setuptools]
license-files = ["LICENSE.txt"]
package-dir = {"" = "."}
package-dir = { "" = "." }
packages = ["numcodecs", "numcodecs.tests"]
zip-safe = false

[tool.setuptools.package-data]
numcodecs = [
"tests/package_with_entrypoint/__init__.py",
"tests/package_with_entrypoint-0.1.dist-info/entry_points.txt"
"tests/package_with_entrypoint-0.1.dist-info/entry_points.txt",
]

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

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"pragma: ${PY_MAJOR_VERSION} no cover",
]
exclude_lines = ["pragma: no cover", "pragma: ${PY_MAJOR_VERSION} no cover"]

[tool.repo-review]
ignore = ["PY005", "PY007", "PP302", "PP308", "PP309", "GH103", "GH212", "PC111", "PC140", "PC160", "PC170", "PC180", "MY100", "RF103"]
ignore = [
"PY005",
"PY007",
"PP302",
"PP308",
"PP309",
"GH103",
"GH212",
"PC111",
"PC140",
"PC160",
"PC170",
"PC180",
"MY100",
"RF103",
]

[tool.pytest.ini_options]
addopts = "-ra --strict-config --strict-markers --cov=numcodecs --cov-report xml --doctest-modules --doctest-glob=*.pyx"
Expand All @@ -133,9 +119,7 @@ doctest_optionflags = [
"ELLIPSIS",
"IGNORE_EXCEPTION_DETAIL",
]
testpaths = [
"numcodecs/tests",
]
testpaths = ["numcodecs/tests"]
norecursedirs = [
".git",
".github",
Expand All @@ -150,17 +134,15 @@ norecursedirs = [
]
log_cli_level = "INFO"
xfail_strict = true
filterwarnings = [
"error",
]
filterwarnings = ["error"]

[tool.cibuildwheel]
environment = { DISABLE_NUMCODECS_AVX2=1 }
environment = { DISABLE_NUMCODECS_AVX2 = 1 }
[tool.cibuildwheel.macos]
environment = { MACOSX_DEPLOYMENT_TARGET=10.9, DISABLE_NUMCODECS_AVX2=1, CFLAGS="$CFLAGS -Wno-implicit-function-declaration" }
environment = { MACOSX_DEPLOYMENT_TARGET = 10.9, DISABLE_NUMCODECS_AVX2 = 1, CFLAGS = "$CFLAGS -Wno-implicit-function-declaration" }
[[tool.cibuildwheel.overrides]]
select = "*-macosx_arm64"
environment = { DISABLE_NUMCODECS_AVX2=1, DISABLE_NUMCODECS_SSE2=1 }
environment = { DISABLE_NUMCODECS_AVX2 = 1, DISABLE_NUMCODECS_SSE2 = 1 }

[tool.ruff]
line-length = 100
Expand Down Expand Up @@ -205,7 +187,7 @@ ignore = [
"TRY003",
"TRY301",
"UP007",
"UP038", # https://github.com/astral-sh/ruff/issues/7871
"UP038", # https://github.com/astral-sh/ruff/issues/7871
# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
"W191",
"E111",
Expand All @@ -225,7 +207,7 @@ ignore = [

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

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

0 comments on commit acca070

Please sign in to comment.