I tested out dmypy (the mypy daemon) last night and it was completing in
under a second after editing a file and rerunning (usually around 0.6s),
which puts it into pre-commit-hook territory.

-chad




On Tue, Mar 3, 2020 at 1:54 AM Ismaël Mejía <ieme...@gmail.com> wrote:

> +1 to do it by default. Great to see the typing work arrive to this
> maturity milestone.
> We can also refer to some of the mypy typing docs for newbies on the
> subject.
>
> On Tue, Mar 3, 2020 at 10:15 AM Kamil Wasilewski
> <kamil.wasilew...@polidea.com> wrote:
> >
> > +1 for enabling mypy as a precommit job
> >
> > This however could be a good occasion to rework the current PythonLint
> job. Since yapf has been introduced, some of the checks made by
> pylint/flake are now unnecessary and could be dismantled. This would
> speed-up PythonLint quite a lot.
> > I volunteer to help with anything as well.
> >
> > On Tue, Mar 3, 2020 at 1:43 AM Robert Bradshaw <rober...@google.com>
> wrote:
> >>
> >> 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.
>

Reply via email to