It seems people are conflating git pre-commit hooks (which IMHO should ideally be in the sub-second range, and run when an author does "git commit") with jenkins pre-commit tests (for which minutes is nothing compared to what we already do). I am +1 to adding mypy to the latter for sure, and think we should probably hold off for the former.
On Mon, Mar 2, 2020 at 4:38 PM Udi Meiri <eh...@google.com> wrote: > > Off-topic: Python lint via pre-commit should be much faster. (I wrote my own > modified-file-only lint in the past) > > On Mon, Mar 2, 2020 at 2:08 PM Kyle Weaver <kcwea...@google.com> wrote: >> >> > Python lint takes 4-5mins to complete. I think if the mypy analysis is >> > really on the order of 10s, the additional time won't matter and could >> > always be enabled. >> >> +1 of course it would be nice to make mypy as fast as possible, but I don't >> think speed needs to be a blocker. The productivity gains we'd get from >> reliable type analysis more than offset the cost IMO. >> >> On Mon, Mar 2, 2020 at 2:03 PM Luke Cwik <lc...@google.com> wrote: >>> >>> Python lint takes 4-5mins to complete. I think if the mypy analysis is >>> really on the order of 10s, the additional time won't matter and could >>> always be enabled. >>> >>> On Mon, Mar 2, 2020 at 1:21 PM Chad Dombrova <chad...@gmail.com> wrote: >>>>> >>>>> I believe that mypy via pre-commit hook will be faster than 10s since it >>>>> only applies to modified files. >>>> >>>> >>>> Correct, with a few caveats: >>>> >>>> pre-commit can be setup to only run if a python file changes. so >>>> modifying a java file won't trigger mypy to run. >>>> if *any* python file changes mypy has to run on the whole codebase, >>>> because a change to one file can affect the others (i.e. a function arg >>>> type changes). it's not really meaningful to run mypy on a single file. >>>> the mypy daemon tracks which files have changed, and runs incremental >>>> updates. so if we setup the precommit hook to run the daemon, we should >>>> see that get appreciably faster. I'll do some tests and report back.