The size of the enclosed section is much bigger. A large section of code has an small well-defined interface.
What you get with typing and interfaces is that all the code has an interface. Small sections of code have a large badly-defined interface.
The main reason people are using typing in Python is to support large Monorepos. Because everything is typed in them, all the code in the repository depends on all the other code in a spaghete dependency graph.
This results in the following issues:
* Small code changes lead to hour long unit test runs since most of the unit tests need to be rerun for every change.
* It's impossible to update the Python version since all the Python code needs to be updated at the same time.
* Long check-in times for changes running MyPy over 100k lines of code.
* Maintainability issues since code can't be updated without knock on effects all over the codebase.
Okay, so what are the benefits of using types in Python:
* On average MyPy type checking will catch 1 bug per developer per year, which wouldn't of being caught normally.
* It makes people who previously coded in statically typed languages feel more familar with the code.
Basically, if you look at the Pros vs Cons, you should ditch the typing checking. It's a net negative to the codebase.
> Small code changes lead to hour long unit test runs since most of the unit tests need to be rerun for every change.
You're writing unit tests wrong if they are taking that long. Unit tests should be quick.
> It's impossible to update the Python version since all the Python code needs to be updated at the same time.
I've done it, so, objectively not impossible.
> Long check-in times for changes running MyPy over 100k lines of code.
TFA addresses this. It can be greatly sped up with use of caching in CI.
> Maintainability issues since code can't be updated without knock on effects all over the codebase.
That's exactly why static types are better - automatic refactors.
> On average MyPy type checking will catch 1 bug per developer per year, which wouldn't of being caught normally.
I catch several per day, simply from IDE highlighting, in real time, and fix them immediately, which only works because of the type system. (maybe it's wrong to call these bugs at this point, it's more like proto-bugs which never even get checked in cause there is immediate feedback)
> It makes people who previously coded in statically typed languages feel more familar with the code.
I came from a fully-dynamic-everything python world, and types were a breath of fresh air.
You've clearly been burned by (a) bad codebase(s), but I think you are drawing all the wrong conclusions. All the benefits of narrow interfaces, easy refactors, high maintainability, can be had with static typed python. I will admit it's much more challenging to be really competent at it than it ought to be, but this has been improving rapidly.
What you get with typing and interfaces is that all the code has an interface. Small sections of code have a large badly-defined interface.
The main reason people are using typing in Python is to support large Monorepos. Because everything is typed in them, all the code in the repository depends on all the other code in a spaghete dependency graph.
This results in the following issues:
* Small code changes lead to hour long unit test runs since most of the unit tests need to be rerun for every change.
* It's impossible to update the Python version since all the Python code needs to be updated at the same time.
* Long check-in times for changes running MyPy over 100k lines of code.
* Maintainability issues since code can't be updated without knock on effects all over the codebase.
Okay, so what are the benefits of using types in Python:
* On average MyPy type checking will catch 1 bug per developer per year, which wouldn't of being caught normally.
* It makes people who previously coded in statically typed languages feel more familar with the code.
Basically, if you look at the Pros vs Cons, you should ditch the typing checking. It's a net negative to the codebase.