Deltares / imod-python

🐍🧰 Make massive MODFLOW models
https://deltares.github.io/imod-python/
MIT License
20 stars 3 forks source link

add type hints #65

Open Manangka opened 5 years ago

Manangka commented 5 years ago

In GitLab by @visr on May 20, 2019, 11:30

PEP 484 and PEP 526 added optional type hints to Python. We can use this in combination with mypy. I believe this can help catching bugs and also make the code easier to read. We don't have to add this everywhere at once, but can do so gradually. All code stays valid Python so there is no need to make use of mypy.

Right now often I check the docstrings to see which types arguments are supposed to be. Of course this is not necessarily correct. If we use the sphinx-autodoc-typehints extension we can make sure the type hints only have to be specified once, can be checked, and still end up in the documentation.

xarray added support for mypy recently as well: https://github.com/pydata/xarray/pull/2655

Manangka commented 5 years ago

In GitLab by @Huite on May 20, 2019, 11:57

Great, I've been thinking about this as well. It wasn't worth it without xarray support, I figured, since so many functions take DataArrays; good to know it's been added.

Manangka commented 1 year ago

In GitLab by @JoerivanEngelen on Oct 26, 2023, 10:55

marked this issue as related to #563