DEV Community

Cover image for Python types are unsustainable
Reece Dunham
Reece Dunham

Posted on • Updated on

Python types are unsustainable

Hi all!

Recently I've come to a realization: Python types are unsustainable.

What do you mean?

Don't get me wrong, Python's type system works. It works relatively well. So does mypy, the tool that does all the type checking. What I believe doesn't work well is the community.

In comparison to other ecosystems, for example the JavaScript ecosystem (through npm), you can see that Python clearly has less types. This is obvious, as TypeScript is essentially based on JavaScript, so types are needed to maintain clarity between dependencies.

The only problem is that this principal should be the same for Python. Why don't more people publish types for popular packages, or their own packages for that matter (yes, I'm included in that)? Really, the only extremely stable types that I know of are for the standard library!

What can be done about this?

Really, what needs to happen is more libraries need to add types and the documentation around writing types needs to be improved.

In the meantime, if you want reliable types, you might want to look into migrating to TypeScript.

Discussion (0)