Skip to content

Commit c700e37

Browse files
committed
Replace validate_stubs scripts with stubtest
1 parent 1321839 commit c700e37

File tree

36 files changed

+11180
-631
lines changed

36 files changed

+11180
-631
lines changed

.github/workflows/test.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,20 @@ jobs:
66
test:
77
runs-on: ubuntu-latest
88
timeout-minutes: 10
9+
strategy:
10+
matrix:
11+
# Oldest non-EOL and newest released
12+
python-version: ["3.9", "3.13"]
13+
fail-fast: false
914

1015
steps:
1116
- name: Check out code
1217
uses: actions/checkout@v2
1318

14-
- name: Setup Python
19+
- name: Setup Python ${{ matrix.python-version }}
1520
uses: actions/setup-python@v2
1621
with:
17-
python-version: "3.11"
22+
python-version: ${{ matrix.python-version }}
1823

1924
- name: Cache pip
2025
uses: actions/cache@v4
@@ -35,6 +40,9 @@ jobs:
3540
- name: Run mypy tests
3641
run: python -m mypy .
3742

43+
- name: Run stubtest
44+
run: python tests/run_stubtests.py
45+
3846
hygiene:
3947
runs-on: ubuntu-latest
4048
timeout-minutes: 10
@@ -45,4 +53,5 @@ jobs:
4553

4654
- name: Run Ruff Linter
4755
uses: astral-sh/ruff-action@v3
48-
- run: ruff format --check
56+
- name: Run Ruff Formatter
57+
run: ruff format --check

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,9 @@ MigrationBackup/
357357
# Python virtual environment
358358
.venv
359359

360+
# Lock files (like uv.lock)
361+
*.lock
362+
360363
# Build files from utils
361364
.eggs
362365
*.egg-info

pyproject.toml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,29 @@ hygiene = ["ruff ==0.11.*"]
1111
tests = [
1212
# Tools used for testing
1313
"docopt-ng",
14-
"mypy ==1.13.*",
14+
"mypy ==1.15.*",
1515
"pyright",
1616

1717
# Typed libraries and stubs
1818
"matplotlib >=3.8",
19+
"numpy >=2",
1920
"pandas-stubs",
2021
"pytest",
2122
"scipy-stubs",
2223
"typing_extensions",
2324

24-
# Untyped libraries, used to prevent "reportMissingImports" and get inferred typing
25+
# Untyped libraries. Used to prevent "reportMissingImports" and get inferred typing
2526
"joblib",
26-
"networkx",
2727
"PyOpenGL",
28-
"scikit-learn",
29-
"sympy",
3028
"traitlets",
3129
"transformers",
30+
31+
# The libraries we're stubbing. Needed for stubtest
32+
"networkx",
33+
"scikit-image",
34+
"scikit-learn",
35+
"sympy",
36+
"vispy",
3237
]
3338
dev = [{ include-group = "hygiene" }, { include-group = "tests" }]
3439

@@ -57,6 +62,7 @@ target-version = "py39"
5762
extend-select = [
5863
"FA", # flake8-future-annotations
5964
"I", # isort
65+
"ICN", # flake8-import-conventions
6066
"PYI", # flake8-pyi
6167
"UP", # pyupgrade
6268
"W", # pycodestyle Warning
@@ -100,12 +106,22 @@ ignore = [
100106
# We keep docstrings in sklearn
101107
"stubs/sklearn/**" = ["PYI021"]
102108

109+
[tool.ruff.lint.flake8-import-conventions.aliases]
110+
# Prevent aliasing these, as it causes false-negatives for certain rules
111+
typing_extensions = "typing_extensions"
112+
typing = "typing"
113+
103114
[tool.ruff.lint.isort]
104115
combine-as-imports = true
105116
extra-standard-library = [
106117
# Group these with stdlib
107118
"typing_extensions",
108119
"_typeshed",
120+
# Extra modules not recognized by Ruff
121+
# Added in Python 3.9
122+
"zoneinfo",
123+
# Added in Python 3.14
124+
"compression",
109125
]
110126

111127
[tool.pyright]

0 commit comments

Comments
 (0)