[Feature Request] Mypy type checking
See original GitHub issue🚀 Feature
Use mypy as the type checker.
Follow-up of https://github.com/DLR-RM/stable-baselines3/issues/1119#issuecomment-1279241980
Motivation
Currently, type checking is done with pytype. It seems that many errors are not correctly detected: #894 #1027 #1039 #1040 #1117 #1119
Pitch
Replace pytype by mypy. Or just add mypy.
Alternatives
No response
Additional context
This would require a lot of changes, in particular removing the use of None
for undefined variables:
current usage
from typing import Optional
class A:
def __init__(self):
self.a = None # type: Optional[int]
what should be done, according to PEP526 (if I understand properly)
class A:
def __init__(self):
self.a: int
Checklist
- I have checked that there is no similar issue in the repo
Issue Analytics
- State:
- Created a year ago
- Comments:13 (8 by maintainers)
Top Results From Across the Web
Feature request: mypy type-checking · Issue #794 · taichi-dev ...
Concisely describe the proposed feature I use the mypy static type-checker in my python projects and I'd like to use it with my...
Read more >mypy 0.991 documentation
Mypy is a static type checker for Python. ... Mypy has a powerful and easy-to-use type system, supporting features such as type inference,...
Read more >Python Type Checking (Guide) - Real Python
In this guide, you'll look at Python type checking. Traditionally, types have been handled by the Python interpreter in a flexible but implicit...
Read more >Optional Static Typing using mypy - Anvil Works
We need a type checker like MyPy to enforce those types. I stumbled across this older thread looking for this exact feature.
Read more >How to start using Python Type Annotations with Mypy
Mypy is a third-party Python library that provides optional static type checking. Unlike other non-dynamic programming languages like Java, where the static ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Let’s do the opposite: we go for option 2 and if fixing is too hard, we switch to 3. Ok for you?
i thought that @Rocamonde described option 2, no?
I was expecting the opposite actually (that’s why I was suggesting option 1).