-
Notifications
You must be signed in to change notification settings - Fork 24
Description
This issue is part of the JOSS review of PyFive (openjournals/joss-reviews#9688)
Dear maintainers,
Currently you mainly use docstrings to document the type of your variables, but no type hints. This can cause issues for users calling the library (see image 1), and also for developers internally (see image 2). Static code analysis will have a hard time following the datatypes when no hints are given. Static analysis tools like Mypy or Pyright can catch many bugs not caught by the tests suite and make the code more readable by being self-documenting.
Image 3 shows a bug I noticed when opening a file with a mode not allowed. This would have been caught with a static code analyzer. I recommend Pyright with strict settings since it catches more bugs than Mypy.
You can add the static type checks as a Pytest so users don't have to run a separate command to run them (e.g., https://github.com/tum-esm/utils/blob/main/tests/test_static_types.py). I also recommend running these tests before any other tests.
Best,
Moritz Oliveira Makowski


