NCAS-CMS / NCAS-CMS/cf-python

Add type hints for type safety

Open
#787 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

code tidy enhancement testing
Dominant language
Python
Stars
150
Forks
23
Avg merge
1d 11h
Merged PRs (30d)
2

Description

Add type hints across the codebase. They are valid syntax for Python v..3.5+, so are safe to add given we are now 3.7+.

We can then use type checking tools, such as mypy, to ensure robustness of our code and catch bugs relating to errors due to incorrect types.

See https://github.com/NCAS-CMS/cf-python/pull/785#discussion_r1638434210 for brief further discussion.

Contributor guide

Open the contributing guide

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

Review the Python codebase alongside PEP 484 and the brief discussion in PR #785, then identify the scope of annotations needed across the project. Consider how mypy would be applied to check the new hints. Done means the codebase has appropriate type hints and can be checked for type-related errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data, tooling
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.