This is to self-promote another nano sizes tool I just published.
Run type coverage checks.
usage: typecov [-h] [-V] coverage reportfile Run type coverage checks. positional arguments: coverage Minimum coverage required. reportfile Path to the type coverage report with line counts. optional arguments: -h, --help show this help message and exit -V, --version show program's version number and exit
typecov 99 .typecov/report/linecount.txt
pip install -r dev-requirements.txt
Or if you have tox setup
This tool can be used with mypy to make sure that the type coverage maintains a certain quatily.
As easy as
pip install typecov
Let's suppose we have a mypy.ini file at the root of a project folder like this:
[mypy] follow_imports = silent check_untyped_defs = True linecount_report = .typecov/report
With this, when we run
mypy [package/file name], a coverage report is generated in the
Now we can execute
typecov 99 .typecov/report/linecount.txt to check if we are maintaining atleast 99% type coverage. We can also add this check as one of the tests in CI/CD pipeline like this or in the tox configuration file like this to maintain a great code quality.
Although it's a very small tool written in only 65 lines of code (as of now), it solves the problem of having duplicate code across projects to do the same thing. Now we have a common tool to assert type coverage that is well tested and maintained.