Read my blog with this tag
Follow my feed with this tag
Searching for: code-quality
My experience adding type annotations to a 2.5k-line Python library [01633477263]
The wwvb package for Python
has been a focus of my recent hobby-time programming. I've used it as a place
to educate myself about the ins and outs of maintaining a Python package.
In the past, I used it to learn about using pylint, black & code coverage
to improve the quality of Python code. Most recently, I added type annotations
through the whole package until mypy --strict was happy with
the whole wwvb package and uwwvb module.
The annotations were added in two steps: See pull requests #7 and #8. Together, these PRs contained 320 insertions and 223 deletions across 14 python files, plus 6 insertions in 2 other files related to CI. I did the work during a part of a day, probably under 4 hours of time spent. Since the package currently contains exactly 2500 physical lines of Python code, adding type annotations touched or added over 10% of physical lines!