Do you... have type annotations? I think you might be missing the point.
Working with these things makes me often think that people who want to write high quality software should just use a better language. But, well, real world is real.
This
If fairness if you set up uv and Ruff and Pyright it's kind of ok. Still have to deal with the general noobness of the ecosystem and the horrific performance, but I've seen worse.