From 514c63dc18639809689d9c39fdce12a293c69677 Mon Sep 17 00:00:00 2001 From: bartzbeielstein <32470350+bartzbeielstein@users.noreply.github.com> Date: Mon, 8 Jun 2026 01:27:42 +0200 Subject: [PATCH] chore(tooling): run ty in CI, add coverage gate, drop legacy flake8 Roadmap #6 tooling baseline for spotoptim: - type checker: run the already-present Astral `ty` in CI via a non-blocking lint step (`ty check src/`, continue-on-error); add [tool.ty]. - coverage: add [tool.coverage] with fail_under=68 ratchet (~71% fast suite), and add --cov to the fast (required) test gate which now enforces it. - legacy lint: remove redundant .flake8 (not invoked, not imported; also dropped from runtime deps) + REUSE.toml entry; add [tool.ruff]/[tool.black]/ [tool.isort] config to match the spot* standard. Non-breaking, non-releasing (chore). Promotes to main with the next release. Co-Authored-By: Claude Opus 4.8 (1M context) --- .flake8 | 5 ----- .github/workflows/ci.yml | 6 +++++- REUSE.toml | 1 - pyproject.toml | 29 ++++++++++++++++++++++++++- uv.lock | 43 ---------------------------------------- 5 files changed, 33 insertions(+), 51 deletions(-) delete mode 100644 .flake8 diff --git a/.flake8 b/.flake8 deleted file mode 100644 index bc16abad..00000000 --- a/.flake8 +++ /dev/null @@ -1,5 +0,0 @@ -[flake8] -extend-ignore = E203 -exclude = .git,__pycache__,docs/source/conf.py,old,build,dist -max-complexity = 100 -max-line-length = 160 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ae0a4d3d..d1bcdf42 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,7 @@ jobs: run: uv sync --extra dev - name: Run pytest (fast — excludes @pytest.mark.slow) - run: uv run pytest tests/ -m "not slow" -n auto --tb=short + run: uv run pytest tests/ -m "not slow" -n auto --tb=short --cov=src/spotoptim --cov-branch --cov-report=term # ── Full suite: nightly schedule + manual dispatch ───────────────────────── test-full: @@ -118,3 +118,7 @@ jobs: - name: Ruff run: uv run ruff check src/ tests/ continue-on-error: true + + - name: Type check with ty (non-blocking) + run: uv run ty check src/ + continue-on-error: true diff --git a/REUSE.toml b/REUSE.toml index d75ef420..4efe8f61 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -5,7 +5,6 @@ SPDX-PackageDownloadLocation = "https://github.com/sequential-parameter-optimiza [[annotations]] path = [ - ".flake8", ".gitignore", ".python-version", ".releaserc.json", diff --git a/pyproject.toml b/pyproject.toml index a7c87e9b..ab3e6dab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,7 +32,6 @@ dependencies = [ "spotdesirability>=0.0.1", "statsmodels>=0.14.6", "dill>=0.4.1", - "flake8>=7.3.0", "black>=26.1.0", "importlib-metadata>=8.7.1", "ty>=0.0.29", @@ -116,3 +115,31 @@ packages = ["src/spotoptim"] [tool.hatch.build] include = ["src/spotoptim/datasets/*.csv"] + +# ── Tooling baseline (roadmap #6): converge on the spot* standard ──────────── +# Ruff replaces the removed legacy .flake8. Line length matches black; CI runs +# `ruff check` non-blocking. +[tool.ruff] +line-length = 88 +target-version = "py313" + +[tool.black] +target-version = ["py313"] + +[tool.isort] +profile = "black" + +[tool.coverage.run] +branch = true +source = ["src/spotoptim"] + +[tool.coverage.report] +# Ratchet: lock in the current ~71% fast-suite coverage so it cannot regress; +# 68 leaves margin for platform variance. Raise deliberately as coverage +# improves. The fast CI gate runs pytest with --cov, enforcing this. +fail_under = 68 + +# Astral `ty` type checker. Run non-blocking in CI (continue-on-error) so it +# surfaces type debt without failing the build; tighten to a gate later. +[tool.ty.environment] +python-version = "3.13" diff --git a/uv.lock b/uv.lock index f86b93c1..b3cd1b2f 100644 --- a/uv.lock +++ b/uv.lock @@ -697,20 +697,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/81/47/dd9a212ef6e343a6857485ffe25bba537304f1913bdbed446a23f7f592e1/filelock-3.29.0-py3-none-any.whl", hash = "sha256:96f5f6344709aa1572bbf631c640e4ebeeb519e08da902c39a001882f30ac258", size = 39812, upload-time = "2026-04-19T15:39:08.752Z" }, ] -[[package]] -name = "flake8" -version = "7.3.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "mccabe" }, - { name = "pycodestyle" }, - { name = "pyflakes" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/9b/af/fbfe3c4b5a657d79e5c47a2827a362f9e1b763336a52f926126aa6dc7123/flake8-7.3.0.tar.gz", hash = "sha256:fe044858146b9fc69b551a4b490d69cf960fcb78ad1edcb84e7fbb1b4a8e3872", size = 48326, upload-time = "2025-06-20T19:31:35.838Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/9f/56/13ab06b4f93ca7cac71078fbe37fcea175d3216f31f85c3168a6bbd0bb9a/flake8-7.3.0-py2.py3-none-any.whl", hash = "sha256:b9696257b9ce8beb888cdbe31cf885c90d31928fe202be0889a7cdafad32f01e", size = 57922, upload-time = "2025-06-20T19:31:34.425Z" }, -] - [[package]] name = "fonttools" version = "4.63.0" @@ -1526,15 +1512,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/41/09/5b161152e2d90f7b87f781c2e1267494aef9c32498df793f73ad0a0a494a/matplotlib_inline-0.2.2-py3-none-any.whl", hash = "sha256:3c821cf1c209f59fb2d2d64abbf5b23b67bcb2210d663f9918dd851c6da1fcf6", size = 9534, upload-time = "2026-05-08T17:33:32.055Z" }, ] -[[package]] -name = "mccabe" -version = "0.7.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/e7/ff/0ffefdcac38932a54d2b5eed4e0ba8a408f215002cd178ad1df0f2806ff8/mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325", size = 9658, upload-time = "2022-01-24T01:14:51.113Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/27/1a/1f68f9ba0c207934b35b86a8ca3aad8395a3d6dd7921c0686e23853ff5a9/mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e", size = 7350, upload-time = "2022-01-24T01:14:49.62Z" }, -] - [[package]] name = "mdurl" version = "0.1.2" @@ -2050,15 +2027,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/8e/37/efad0257dc6e593a18957422533ff0f87ede7c9c6ea010a2177d738fb82f/pure_eval-0.2.3-py3-none-any.whl", hash = "sha256:1db8e35b67b3d218d818ae653e27f06c3aa420901fa7b081ca98cbedc874e0d0", size = 11842, upload-time = "2024-07-21T12:58:20.04Z" }, ] -[[package]] -name = "pycodestyle" -version = "2.14.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/11/e0/abfd2a0d2efe47670df87f3e3a0e2edda42f055053c85361f19c0e2c1ca8/pycodestyle-2.14.0.tar.gz", hash = "sha256:c4b5b517d278089ff9d0abdec919cd97262a3367449ea1c8b49b91529167b783", size = 39472, upload-time = "2025-06-20T18:49:48.75Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/d7/27/a58ddaf8c588a3ef080db9d0b7e0b97215cee3a45df74f3a94dbbf5c893a/pycodestyle-2.14.0-py2.py3-none-any.whl", hash = "sha256:dd6bf7cb4ee77f8e016f9c8e74a35ddd9f67e1d5fd4184d86c3b98e07099f42d", size = 31594, upload-time = "2025-06-20T18:49:47.491Z" }, -] - [[package]] name = "pycparser" version = "3.0" @@ -2139,15 +2107,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/f6/d2/42dd53d0a85c27606f316d3aa5d2869c4e8470a5ed6dec30e4a1abe19192/pydantic_core-2.46.4-cp314-cp314t-win_arm64.whl", hash = "sha256:4fcbe087dbc2068af7eda3aa87634eba216dbda64d1ae73c8684b621d33f6596", size = 2017325, upload-time = "2026-05-06T13:40:52.723Z" }, ] -[[package]] -name = "pyflakes" -version = "3.4.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/45/dc/fd034dc20b4b264b3d015808458391acbf9df40b1e54750ef175d39180b1/pyflakes-3.4.0.tar.gz", hash = "sha256:b24f96fafb7d2ab0ec5075b7350b3d2d2218eab42003821c06344973d3ea2f58", size = 64669, upload-time = "2025-06-20T18:45:27.834Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/c2/2f/81d580a0fb83baeb066698975cb14a618bdbed7720678566f1b046a95fe8/pyflakes-3.4.0-py2.py3-none-any.whl", hash = "sha256:f742a7dbd0d9cb9ea41e9a24a918996e8170c799fa528688d40dd582c8265f4f", size = 63551, upload-time = "2025-06-20T18:45:26.937Z" }, -] - [[package]] name = "pygments" version = "2.20.0" @@ -2931,7 +2890,6 @@ source = { editable = "." } dependencies = [ { name = "black" }, { name = "dill" }, - { name = "flake8" }, { name = "importlib-metadata" }, { name = "jupyter" }, { name = "matplotlib" }, @@ -2993,7 +2951,6 @@ requires-dist = [ { name = "black", marker = "extra == 'dev'", specifier = ">=24.1.0" }, { name = "colorama", marker = "extra == 'docs'", specifier = ">=0.4.6" }, { name = "dill", specifier = ">=0.4.1" }, - { name = "flake8", specifier = ">=7.3.0" }, { name = "griffe", marker = "extra == 'docs'", specifier = ">=1.7.3" }, { name = "importlib-metadata", specifier = ">=8.7.1" }, { name = "importlib-metadata", marker = "extra == 'docs'" },