Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add type hints #65

Open
Manangka opened this issue May 20, 2019 · 2 comments
Open

add type hints #65

Manangka opened this issue May 20, 2019 · 2 comments
Labels
enhancement New feature or request story

Comments

@Manangka
Copy link
Collaborator

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: pydata/xarray#2655

@Manangka
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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

marked this issue as related to #563

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request story
Projects
Status: 🤝 Accepted
Development

No branches or pull requests

2 participants