Open jacobtomlinson opened 4 months ago
Have you looked into Pyright? I think there are a lot of reasons to consider it over MyPy for open-source libraries hoping to enforce strict typing. It's by far the most compliant with the Python typing spec, and already has support for 3.12-3.13 features through typing extensions.
I hadn't considrered it, I'm not especially familiar with Pyright. Given that it checks all untyped code by default it does make sense to equate it to mypy --strict
.
I see most projects that I contribute to using mypy
, but maybe that's changing? I'm generally happy to use whatever tools makes kr8s
the best for the community, so if folks want pyright here then I encourage 👍 reactions on your comment 😃.
I hadn't considrered it, I'm not especially familiar with Pyright. Given that it checks all untyped code by default it does make sense to equate it to
mypy --strict
.I see most projects that I contribute to using
mypy
, but maybe that's changing? I'm generally happy to use whatever tools makeskr8s
the best for the community, so if folks want pyright here then I encourage 👍 reactions on your comment 😃.
I'd say in most cases it's going to be stricter, one difference is that Pyright technically doesn't require you annotate all return paths. While it's probably a good idea for MyPy users (you can enforce this through Ruff's ANN rule-set instead), it has similar inference capabilities to TypeScript. This can especially be helpful with untyped/partially typed libraries you're bringing in though. MyPy just assumes Any
in the case that a return-type is provided, which can obviously lead to more typing issues if you're dealing with some external code.
Which project are you requesting an enhancement for?
kr8s
What do you need?
Continuing on from #381 it might be fun to get
mypy --strict
passing. This is by no means necessary but it might makekr8s
even more pleasant to use for folks who like strong type annotations and help shake out some bugs.It's unclear whether
--strict
should be added to the precommit hooks as strict typing may increase the barrier to contributing too much.