CLI tool for providing a clean slate for mypy usage within a project.
Project description
Mypy Clean Slate
CLI tool for providing a clean slate for mypy usage within a project
It can be difficult to get a large project to the point where mypy --strict
can be run on it. Rather than incrementally increasing the severity, either overall or per module, mypy_clean_slate
enables one to ignore all previous errors so that mypy --strict
(or similar) can be used immediately.
Usage
usage: main.py [-h] [-n] [-r] [-a] [-o MYPY_REPORT_OUTPUT]
CLI tool for providing a clean slate for mypy usage within a project.
optional arguments:
-h, --help show this help message and exit
-n, --none Handle missing "-> None" hints on functions.
-r, --generate_mypy_error_report
Generate 'mypy_error_report.txt' in the cwd.
-a, --add_type_ignore
Add "# type: ignore[<error-code>]" to suppress all raised mypy errors.
-o MYPY_REPORT_OUTPUT, --mypy_report_output MYPY_REPORT_OUTPUT
File to save report output to (default is mypy_error_report.txt)
See ./tests/test_mypy_clean_slate.py
for an example.
Issues
Handling lines with preexisting ignores.
If there are instances of pylint: disable
or noqa:
ignores then these currently have
to be handled separately. eg:
def add(a, b): # pylint: disable=invalid-name
return a + b
would be manually rewritten as
def add(a, b): # type: ignore[no-untyped-def] # pylint: disable=invalid-name
return a + b
TODO
- handle there being different types of ignores (pylint/flake8/etc) already within the code.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mypy_clean_slate-0.1.3.tar.gz
(5.3 kB
view hashes)
Built Distribution
Close
Hashes for mypy_clean_slate-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c03a5adb2ed620a64fb5e761863f3176740b3f7ed67318a858193048d6e9754 |
|
MD5 | 7aa09b946f062e6679e63f6a0dfb1aa7 |
|
BLAKE2b-256 | 62eca8261ab3392f6bebb412c3eee9b993d935f99d2d5abb19cf16b7900aa77f |