Replace mypy with ty
https://github.com/astral-sh/ty
The new type checker by Astral. I bet it's a lot faster.
Is MyPy speed a (real) problem?
ty is not stable:
Warning
ty is in preview and is not ready for production use.
We're working hard to make ty stable and feature-complete, but until then, expect to encounter bugs, missing features, and fatal errors.
Moreover, the CL pyspecs use type expressions like List[Validator, <integer expression>]. Type checkers are not supposed to handle them (i.e. a form of dependent type). So, there must be some configuration workaround. It somehow works with MyPy, but can potentially cause problems when switching to ty, if it doesn't have equivalent functionality.
The dependent type problem looks like a more important problem to me, since bugs, which in theory must be caught by static type checking, can slip (as a type checker should be configured to ignore dependent types, e.g. by replacing them with Any). In particular, MyPy might be more suited to resolving the issue, e.g. via writing a MyPy plugin (however, such a plugin alone is not enough).
Is MyPy speed a (real) problem?
No, this is not a real problem 😄 this issue is just a reminder that I would like to look into it (pros/cons).
I am a fan of Astral products. I am aware that it's not stable. The dependent type problem does seem important.
The dependent type problem does seem important.
I've opened #4384 issue. Initially, I was thinking about code preprocessing + MyPy plugin. However, I think we can have a more generic solution to the dependent type problem, which allows switching to other type checkers like ty in future.
@marioevz is this what we are using in STEEL?
@marioevz is this what we are using in STEEL?
Not yet, but we are going to explore switching at some point too!
@marioevz is this what we are using in STEEL?
Not yet, but we are going to explore switching at some point too!
Then, let's pioneer here :-)
As @ericsson49 mentioned, I don't believe it's currently possible because of our types.
I am expressing estuthiasm that perhaps we could try to try it first if it becomes more stable :-)
I see that neither solves the problem of dependent types.