Open alexeagle opened 2 months ago
Honestly that one looks great. It fixes the mypy caching issue which is the biggest problem with this ruleset.
Ok, I spent some time looking into it, and it's not a clear win. First, individual jobs don't seem much faster, which surprised me. I thought with the caching they would go a lot faster. Some jobs even seemed to go slower. But the biggest issue is that in order to share the caches, I guess, the mypy jobs depend on each other, so if you modify some dependency then you have to run mypy jobs down the dependency tree in serial rather than in parallel.
I have some local improvements that I've been meaning to get up here into this project. Let me try to find some time to do that.
Great, thanks a bunch for trying that out and reporting what you found.
@jbedard has been making changes in rules_ts to avoid that "run jobs down the dependency tree in serial" - but that's only recently possible because TypeScript introduced a way to create the equivalent of .pyi
files quickly and without type-checking, so that each type-check action can have inputs it needs from the tree without waiting for those dependencies to type-check.
Perhaps the modern era of Python tooling includes some blazing fast (Rust?) tool that can produce .pyi
files like that.
Without such a thing, I don't see how you could correctly type-check a library with no type information from its dependents, and would expect that serial chain.
@alexeagle at one point I had a python tool that could spit out pyi files from the AST; it's actually not too bad because ast
is built-in and you can just drop function bodies. I think there might be remnants of it in the repo I shared with you last time I seriously looked at mypy, in case you want to poke around ;)
This module https://registry.bazel.build/modules/rules_mypy is new and claims to resolve some of the issues in this repo. It also has enthusiastic maintainers and not so much legacy baggage. @adzenith I think we should compare this repo with that one to decide if it's clearly a superset of what we are doing.