From f1af94828969f31530ca88e6dcdcdc0d2a6fc58c Mon Sep 17 00:00:00 2001 From: Vecko <36369090+VeckoTheGecko@users.noreply.github.com> Date: Tue, 10 Mar 2026 15:52:05 +0100 Subject: [PATCH 1/2] Configure ty typechecking --- .github/workflows/ci.yml | 11 ++--------- docs/development/index.md | 4 ++-- pixi.toml | 6 ++---- pyproject.toml | 24 ++---------------------- 4 files changed, 8 insertions(+), 37 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e51349a75..f9b6ff6af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -169,9 +169,8 @@ jobs: typechecking: name: "TypeChecking: pixi run typing" runs-on: ubuntu-latest + continue-on-error: true # TODO: Remove once typing is stable needs: [cache-pixi-lock] - # TODO v4: Enable typechecking again - if: false steps: - name: Checkout uses: actions/checkout@v5 @@ -186,13 +185,7 @@ jobs: cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }} - name: Typechecking run: | - pixi run typing --non-interactive --html-report mypy-report - - name: Upload test results - if: ${{ always() }} # Upload even on mypy error - uses: actions/upload-artifact@v7 - with: - name: Mypy report - path: mypy-report + pixi run typing --output-format github build-and-upload-nightly-parcels: # for alpha testing needs: [cache-pixi-lock] permissions: diff --git a/docs/development/index.md b/docs/development/index.md index 4f2deffe5..16181cf8d 100644 --- a/docs/development/index.md +++ b/docs/development/index.md @@ -132,8 +132,8 @@ See below for more Pixi commands relevant to development. **Code quality** -- `pixi run lint` - Run pre-commit hooks on all files (includes formatting, linting, and other code quality checks) -- `pixi run typing` - Run mypy type checking on the codebase +- `pixi run lint` - Run [pre-commit](https://pre-commit.com/) hooks on all files (includes formatting, linting, and other code quality checks) +- `pixi run typing` - Run [ty](https://docs.astral.sh/ty/) type checking on the codebase **Different environments** diff --git a/pixi.toml b/pixi.toml index 50983d639..2e18e0847 100644 --- a/pixi.toml +++ b/pixi.toml @@ -113,12 +113,10 @@ numpydoc = "*" numpydoc-lint = { cmd = "python tools/numpydoc-public-api.py", description = "Lint public API docstrings with numpydoc." } [feature.typing.dependencies] -mypy = "*" -lxml = "*" # in CI -types-tqdm = "*" +ty = "*" [feature.typing.tasks] -typing = { cmd = "mypy src/parcels --install-types", description = "Run static type checking with mypy." } +typing = { cmd = "ty check", description = "Run static type checking with ty." } [environments] diff --git a/pyproject.toml b/pyproject.toml index 392cd8a2c..a0a08936e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -157,25 +157,5 @@ convention = "numpy" [tool.ruff.lint.isort] known-first-party = ["parcels"] -[tool.mypy] -files = [ - "parcels/_typing.py", - "parcels/tools/*.py", - "parcels/grid.py", - "parcels/field.py", - "parcels/fieldset.py", -] - -[[tool.mypy.overrides]] -module = [ - "parcels._version_setup", - "mpi4py", - "scipy.spatial", - "sklearn.cluster", - "zarr", - "cftime", - "pykdtree.kdtree", - "netCDF4", - "pooch", -] -ignore_missing_imports = true +[tool.ty.src] +include = ["./src/"] From 06f91f240577303c1c3d3991563690de63720630 Mon Sep 17 00:00:00 2001 From: Vecko <36369090+VeckoTheGecko@users.noreply.github.com> Date: Tue, 10 Mar 2026 16:13:20 +0100 Subject: [PATCH 2/2] Force green ticks --- .github/workflows/ci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f9b6ff6af..de8601100 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -169,7 +169,6 @@ jobs: typechecking: name: "TypeChecking: pixi run typing" runs-on: ubuntu-latest - continue-on-error: true # TODO: Remove once typing is stable needs: [cache-pixi-lock] steps: - name: Checkout @@ -184,8 +183,8 @@ jobs: cache: true cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }} - name: Typechecking - run: | - pixi run typing --output-format github + run: | # TODO: Remove `|| true` once typechecking is stable + pixi run typing --output-format github || true build-and-upload-nightly-parcels: # for alpha testing needs: [cache-pixi-lock] permissions: