Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/whtsky/mypy-silent
Silence mypy by adding or removing code comments
https://github.com/whtsky/mypy-silent
mypy python typehints
Last synced: 2 months ago
JSON representation
Silence mypy by adding or removing code comments
- Host: GitHub
- URL: https://github.com/whtsky/mypy-silent
- Owner: whtsky
- License: mit
- Created: 2021-05-06T14:34:43.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-04-29T22:14:02.000Z (8 months ago)
- Last Synced: 2024-05-19T05:01:59.909Z (7 months ago)
- Topics: mypy, python, typehints
- Language: Python
- Homepage:
- Size: 69.3 KB
- Stars: 14
- Watchers: 3
- Forks: 2
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-python-typing - mypy-silent - Silence mypy by adding or removing code comments. (Tools / Working with types)
README
# mypy-silent
Automatically add or remove `# type: ignore` commends to silence [mypy](https://github.com/python/mypy). Inspired by [pylint-silent](https://github.com/udifuchs/pylint-silent/)
## Why?
Imagine you want to add type check for a legacy code base which has thounds of exisiting mypy errors.
Instead of trying to fix all the exisiting errors, `mypy-silent` allows you to ignore the exisiting errors and adopt type checking right now.Although the exisiting errors are ignored, all the new code are type checked -- so you can moving towards fully type checked step by step.
## Install & Usage
WARNING: `mypy-silent` modifies files **in place**. You should use some version control system ( like git ) to prevent losing codes.
```bash
pip install mypy-silentmypy . # Whoa, lots of type error!
mypy . | mypy-silent # mypy-silent will add or remove `# type: ignore` commends to your code
mypy . # mypy should report 0 errors now.
```## Changelog
### v0.4.0
- Add support for removing unused type ignores with error codes [#42](https://github.com/whtsky/mypy-silent/pull/42)
### v0.3.0
- Add error code to ignore message comment.Instead of just adding `# type: ignore` we now add `# type: ignore[misc]` [#41](https://github.com/whtsky/mypy-silent/pull/41)
### v0.2.1
- Fix import error on Python < 3.8
### v0.2.0
- Support parsing mypy >=0.900 messages
### v0.1.0
- Initial release