Skip to content

Migrate back to mypy and enable typechecking in CI#2595

Merged
VeckoTheGecko merged 7 commits intoParcels-code:mainfrom
VeckoTheGecko:push-opkypksroupl
Apr 28, 2026
Merged

Migrate back to mypy and enable typechecking in CI#2595
VeckoTheGecko merged 7 commits intoParcels-code:mainfrom
VeckoTheGecko:push-opkypksroupl

Conversation

@VeckoTheGecko
Copy link
Copy Markdown
Contributor

Description

xref #2540

After trying out ty some more, I think it's best if we go for mypy. It has better support in the ecosysytem, and ty was flagging a lot of 'errors' within xarray internals causing noise.

Changes:

  • Switch from ty to mypy
  • Enable mypy in CI (i.e., we will get red crosses if it fails)
  • Curate the mypy settings taking inspiration from other open source projects
  • Fix a bunch of typing errors
  • Add an ignore list on files (as we improve typing across the codebase, we will reduce this ignore list)

Checklist

  • Closes None

Comment thread .github/workflows/ci.yml Fixed
Copy link
Copy Markdown
Member

@erikvansebille erikvansebille left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good. What will the workflow be? Will we get errors when pushing PRs that fail type checking? Or will the process be more graceful?

@VeckoTheGecko
Copy link
Copy Markdown
Contributor Author

Will we get errors when pushing PRs that fail type checking?

Yes, we will get errors that fail typechecking. Type checking will be like unit tests in this regard.

Devs will need to be familiar to some extent with how typechecking in Python works (how to fix and how to supress warnings), or maintainers will need to push edits to fix the typing should contributions mis-specify them

@VeckoTheGecko
Copy link
Copy Markdown
Contributor Author

What will the workflow be?

You can do pixi shell then mypy to run the typechecking.

I realise I need to review the contributing instructions. Will do so before merging.

@VeckoTheGecko
Copy link
Copy Markdown
Contributor Author

I realise I need to review the contributing instructions. Will do so before merging.

Just reviewed these. They're already up to date.

@VeckoTheGecko VeckoTheGecko merged commit 3a40fa4 into Parcels-code:main Apr 28, 2026
8 of 14 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Parcels development Apr 28, 2026
@VeckoTheGecko VeckoTheGecko deleted the push-opkypksroupl branch April 28, 2026 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants