Skip to content

Conversation

@romanc
Copy link
Collaborator

@romanc romanc commented Oct 29, 2025

Description

This PR suggests better defaults for the mypy configuration. The new rules apply don't apply within pyfv3.stencils. That would have been too much effort to start with. Types aren't less safe than before because before the exceptions were just made for the whole repo (now it's contained to pyfv3.stencils and select files that weren't typed before).

In addition, the PR includes

  • update of the linting tools
  • new tool: flake8-bugbear
  • more modern type hints (e.g. Dict[...] -> dict[...])

Note that even this configuration doesn't catch, what is about to be fixed in #96 (for NOAA-GFDL/pace#156).

/cc @twicki @FlorianDeconinck

How Has This Been Tested?

Self testing with new checks by mypy and flake8-bugbear. All good as long as CI (in particular the linting job) is still green.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation: N/A
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules: N/A
  • New check tests, if applicable, are included
  • Targeted model if this changed was triggered by a model need/shortcoming: N/A

apparently these break either with `|` not defined for
`_FieldDescriptor` or - in combination with  `from __future__ import
annotations` - we end up in GT4Py, which gets confused and can't
resolve the argument annotations anymore.
@romanc
Copy link
Collaborator Author

romanc commented Oct 29, 2025

Sorry for the back and forth. This should be good for review now and is not time critical in any way.

@romanc romanc removed the request for review from FlorianDeconinck October 30, 2025 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants