mdanalysis
mdanalysis copied to clipboard
Adding Type Hints for MDAnalysis
Is your feature request related to a problem?
MDAnalysis library currently lacks type hints which would help in providing better documentation and help catch errors easily .
Describe the solution you'd like
Proving type hints and annotations for all modules of the library . Usage of mypy for type checking .
#3463 #2450 are the previous issues regarding this .
Thank you @umak1106 for opening this issue.
There are 3 main objectives with the type hinting of the library:
- detect errors in the library code before they are merged;
- detect errors in downstream code;
- help with the documentation
One extra benefit of going through the code to add type hinting is that we may identify inconsistencies in the library.
The first thing to do is to make sure that types are checked for each pull request. This means mypy and pyright must be run in CI. At first, they must run without blocking the PR as they will fail until the type hinting is advanced enough; later, the job that run these tool must be made to clock a PR if types are not correct.
- [ ] #3698
- [ ] #3699
Once mypy and pyright run in CI, we need to start annotating the code. Then, most things will depend on the output of both mypy and pyright.
Thank you @umak1106 for opening this issue.
There are 3 main objectives with the type hinting of the library:
- detect errors in the library code before they are merged;
- detect errors in downstream code;
- help with the documentation
One extra benefit of going through the code to add type hinting is that we may identify inconsistencies in the library.
The first thing to do is to make sure that types are checked for each pull request. This means mypy and pyright must be run in CI. At first, they must run without blocking the PR as they will fail until the type hinting is advanced enough; later, the job that run these tool must be made to clock a PR if types are not correct.
- [ ] run mypy and pyright in CI
- [ ] make mypy and pyright in CI blocking
Once mypy and pyright run in CI, we need to start annotating the code. Then, most things will depend on the output of both mypy and pyright.
ok mentor .