Deltares / Deltares/imod-python

add type hints

Open
#65 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement story
Dominant language
Python
Stars
41
Forks
12
Avg merge
21h 8m
Merged PRs (30d)
1

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the Python code and its existing docstrings to identify where argument and return types are documented. Define a manageable first scope for PEP 484 and PEP 526 annotations, then assess mypy and sphinx-autodoc-typehints; done means the selected code has type hints that can be checked and reflected in the documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.