From cb0d3e0c4943a319bee816c4d18823934ba8c5f9 Mon Sep 17 00:00:00 2001 From: jorenham Date: Mon, 9 Sep 2024 00:33:32 +0200 Subject: [PATCH 1/2] define more poe tasks --- pyproject.toml | 48 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6ba999b9..04035fd3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,15 +47,41 @@ pre-commit = "^3.8.0" type = "poetry" [tool.poe.tasks] +clean = """ +rm -rf + scipy-stubs/**/*.pyc + scipy-stubs/**/__pycache__ + ./**/.mypy_cache + ./**/.ruff_cache +""" + lint = "ruff check" -verifytypes = "basedpyright --ignoreexternal --verifytypes scipy-stubs" +format = "ruff format" -[tool.poe.tasks.stubtest] -cmd = "stubtest --mypy-config-file=pyproject.toml --allowlist=tests/stubtest/allowlist.txt $modules" -args = [ - {name = "modules", positional = true, multiple = true, default = "scipy"}, -] +_typetest_bpr = "basedpyright typetests" +_typetest_mypy = "mypy --config-file=pyproject.toml typetests" +typetest = ["_typetest_bpr", "_typetest_mypy"] + +[tool.poe.tasks.pyright] +cmd = "basedpyright scipy-stubs/$path" +args = [{name = "path", positional = true, multiple = true, default = ""}] +[tool.poe.tasks.mypy] +cmd = "mypy --config-file=pyproject.toml scipy-stubs/$path" +args = [{name = "path", positional = true, multiple = true, default = ""}] + +[tool.poe.tasks.verifytypes] +cmd = "basedpyright --ignoreexternal --verifytypes scipy-stubs/$path" +args = [{name = "path", positional = true, multiple = true, default = ""}] + +[tool.poe.tasks.stubtest] +cmd = """ +stubtest + --mypy-config-file=pyproject.toml + --allowlist=tests/stubtest/allowlist.txt + $modules +""" +args = [{name = "modules", positional = true, multiple = true, default = "scipy"}] [tool.mypy] python_version = "3.10" @@ -68,15 +94,15 @@ warn_unused_ignores = true [tool.pyright] -include = ["scipy-stubs"] +include = ["scipy-stubs", "typetests"] exclude = [".cache"] ignore = [".venv"] -pythonPlatform = "All" -pythonVersion = "3.10" -stubPath = "." -typeCheckingMode = "strict" venv = ".venv" venvPath = "." +stubPath = "." +pythonVersion = "3.10" +pythonPlatform = "All" +typeCheckingMode = "strict" deprecateTypingAliases = true enableTypeIgnoreComments = false From ec55b2f8b5d1065e9bf931f255bfd166588c5fa2 Mon Sep 17 00:00:00 2001 From: jorenham Date: Mon, 9 Sep 2024 00:36:03 +0200 Subject: [PATCH 2/2] run typetests in CI --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18bac410..79f85647 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,6 +49,9 @@ jobs: run: poe stubtest -- --concise continue-on-error: true + - name: typetest + run: poe typetest + # TODO # - uses: scientific-python/repo-review@v0.11.2 # with: