It was a bear to get set up (oh NixOS...), but I imagine it's easier on other platforms: `pytype` from Google is the God Linter for Python.
It:
- seamlessly supports everything from old-ass Python 2 code up to very recent (like 3.10 or someting)
- it can and does exploit `mypy`-style annotations, but needs none to deeply analyze your code and actually find bugs
- it seems to do fairly serious deep PLT magicks. i admittedly haven't dived deep here but it's doing stuff that looks like escape analysis-level whole-program analysis
- it heavily caches and optimizes it's (understandably) heavy lifting via Ninja
It demolishes everything else I've tried. I will definitely take `Ruff` for a spin, we've got a lot of Python and I'm always up for discovering there's a better tool, but the dark magic PLT wizards at Google have probably gotten pretty close to what can be done.
it's worth exploring some of the other type checkers as well, since they make different tradeoffs - in particular, microsoft's pyright[2] (written in typescript!) can run incrementally within vscode, and tends to add new and experimentally proposed typing PEPs faster than we do.
[1] https://github.com/google/pytype/blob/main/docs/developers/i...