@@ -9,26 +9,13 @@ license = "BSD-3-Clause"
99urls.Source = " https://github.com/scikit-learn-contrib/sklearn-ann"
1010urls.Documentation = " https://sklearn-ann.readthedocs.io/"
1111dynamic = [" version" , " readme" ]
12- requires-python = " >=3.9 "
12+ requires-python = " >=3.10 "
1313dependencies = [
1414 " scikit-learn>=1.6.0" ,
1515 " scipy>=1.11.1,<2.0.0" ,
1616]
1717
1818[project .optional-dependencies ]
19- tests = [
20- " pytest>=6.2.1" ,
21- " pytest-cov>=2.10.1" ,
22- ]
23- docs = [
24- " sphinx>=7" ,
25- " sphinx-gallery>=0.8.2" ,
26- " sphinx-book-theme>=1.1.0" ,
27- " sphinx-issues>=1.2.0" ,
28- " numpydoc>=1.1.0" ,
29- " matplotlib>=3.3.3" ,
30- " scanpydoc" ,
31- ]
3219annoy = [
3320 " annoy>=1.17.0,<2.0.0" ,
3421]
@@ -46,6 +33,26 @@ annlibs = [
4633 " sklearn-ann[annoy,faiss,pynndescent,nmslib]" ,
4734]
4835
36+ [dependency-groups ]
37+ docs = [
38+ " sphinx>=7" ,
39+ " sphinx-gallery>=0.8.2" ,
40+ " sphinx-book-theme>=1.1.0" ,
41+ " sphinx-issues>=1.2.0" ,
42+ " numpydoc>=1.1.0" ,
43+ " matplotlib>=3.3.3" ,
44+ " scanpydoc" ,
45+ ]
46+ tests = [
47+ " pytest>=6.2.1" ,
48+ " pytest-cov>=2.10.1" ,
49+ ]
50+ typing = [
51+ " mypy" ,
52+ " matplotlib" , # examples are type checked, too
53+ " scipy-stubs" ,
54+ ]
55+
4956[tool .hatch .version ]
5057source = " vcs"
5158
@@ -74,6 +81,7 @@ select = [
7481 " PTH" , # Pathlib
7582 " RUF" , # Ruff’s own rules
7683 " T20" , # print statements
84+ " TC" , # type checking
7785]
7886ignore = [
7987 # Don’t complain about “confusables”
@@ -84,19 +92,51 @@ ignore = [
8492"tests/*.py" = [" T20" ]
8593[tool .ruff .lint .isort ]
8694known-first-party = [" sklearn_ann" ]
95+ required-imports = [" from __future__ import annotations" ]
96+ [tool .ruff .lint .flake8-type-checking ]
97+ exempt-modules = []
98+ strict = true
8799
88100[tool .hatch .envs .docs ]
89101installer = " uv"
90- features = [" docs" , " annlibs" ]
102+ features = [" annlibs" ]
103+ dependency-groups = [" docs" ]
91104scripts.build = " sphinx-build -M html docs docs/_build"
92105
106+ [tool .hatch .envs .hatch-check-types ]
107+ features = [" annlibs" ]
108+ dependency-groups = [" tests" , " typing" ]
109+ scripts.check = " mypy {args:.}"
110+
93111[tool .hatch .envs .hatch-test ]
94112default-args = []
95- features = [" tests" , " annlibs" ]
113+ features = [" annlibs" ]
114+ dependency-groups = [" tests" ]
96115
97116[tool .hatch .build .targets .wheel ]
98117packages = [" src/sklearn_ann" ]
99118
119+ [tool .mypy ]
120+ python_version = " 3.12"
121+ mypy_path = [" src" , " tests" ]
122+ strict = true
123+ explicit_package_bases = true # pytest doesn’t do __init__.py
124+ no_implicit_optional = true
125+ disallow_untyped_decorators = false # e.g. pytest.mark.parametrize
126+ follow_untyped_imports = true
127+ # follow_untyped_imports makes these readable, but not annotated
128+ untyped_calls_exclude = [" sklearn" , " joblib" , " pynndescent" ]
129+
130+ [[tool .mypy .overrides ]]
131+ # pynndescent has no __all__, so its re-exports are implicit
132+ module = [" pynndescent" ]
133+ no_implicit_reexport = false
134+
135+ [[tool .mypy .overrides ]]
136+ # nmslib is a compiled extension module without stubs
137+ module = [" nmslib" ]
138+ ignore_missing_imports = true
139+
100140[build-system ]
101141requires = [" hatchling" , " hatch-vcs" , " hatch-fancy-pypi-readme" ]
102142build-backend = " hatchling.build"
0 commit comments