Polars currently uses mypy for type-checking, but it's a bit slow on a codebase of this size (~1 minute)
Pyrefly takes about 1-2 seconds on my laptop, and it is a bit stricter on some things. ty is similar.
Before being able to introduce either of them, quite a few type issues which mypy doesn't flag need addressing. I'm looking into this. There's also a few issues which need addressing upstream - I'll report things as and when I find them
So, here's a tracking issue that I'll reference in such PRs
Both pyrefly and ty are quite new, so I'm not sure I'd suggest completely removing mypy for the time being. Personally I don't see the harm in running multiple type checkers in CI, especially if some are quite fast
pyrefly issues uncovered as a result of this:
precursor PRs:
relevant issues:
Polars currently uses
mypyfor type-checking, but it's a bit slow on a codebase of this size (~1 minute)Pyrefly takes about 1-2 seconds on my laptop, and it is a bit stricter on some things.
tyis similar.Before being able to introduce either of them, quite a few type issues which mypy doesn't flag need addressing. I'm looking into this. There's also a few issues which need addressing upstream - I'll report things as and when I find them
So, here's a tracking issue that I'll reference in such PRs
Both pyrefly and ty are quite new, so I'm not sure I'd suggest completely removing mypy for the time being. Personally I don't see the harm in running multiple type checkers in CI, especially if some are quite fast
pyrefly issues uncovered as a result of this:
_lru_cache_wrapperhas no attributegetwhen using lru-cached property facebook/pyrefly#2979unsafe-overlapreported for checking if Iterable is Generator facebook/pyrefly#2978Iteratorignored when reportinginvalid-yieldfacebook/pyrefly#2976bad-argument-typewhen using metaclass facebook/pyrefly#2968[bad-argument-type]forlist(null_values.items())facebook/pyrefly#2912list[str]is not assignable to parameteriterablewith typeIterable[LiteralString]in functionmap.__new__facebook/pyrefly#3030Regression when using type alias on Enum facebook/pyrefly#3042(not a blocker, have worked around it)Anydeclaration before loop ignored facebook/pyrefly#3046bad-specializationfalsely reported when matching typevar facebook/pyrefly#3047__reversed__signature ignored when usingreversedandenumerate? facebook/pyrefly#3048*is not supported betweenlist[dict[str, Unknown | None]]andLiteral[1000][unsupported-operation] facebook/pyrefly#3074precursor PRs:
ty/pyrefly#27050__structifywas being ignored #27148test_dtype_concat_3735not actually iterating through numeric dtypes #27178test_scan_lines#27213type: ignorein _AioDataFrameResult #27311udfs.py#27341Sequence[int]fromDataFrame.__setitem__key#27355type: ignorestatements #27360relevant issues:
DataFrame.__init__accepts any input if not all optional dependencies are installed #27347