-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add codespell to pre-commit config #18645
Conversation
Diff from mypy_primer, showing the effect of this PR on open source code: django-stubs (https://github.com/typeddjango/django-stubs): 2.04x faster (53.6s -> 26.3s in a single noisy sample)
|
How long does this take to run? Our current pre-commit config already feels slow when running locally. (Somewhat unrelated: I wonder if there is a way to move the slower tasks to only run CI by default?) |
A full run of just codespell (via
Yes, there is, although it doesn't fully work with the On my machine it's |
(irrelevant to this PR)
and it's hella slow when it has to reformat the file, actually: 7-8 seconds for any edit of Black is probably the main reason why our pre-commit feels so slow locally when running on changed files - unless you edit GH actions, other hooks either are skipped (do not apply) or complete immediately. |
Yeah, we are using Black in part because it's compiled with mypyc, and it gives us an incentive to make mypyc better. Though on my work laptop (M1 Max) reformatting Black should do much less work than mypy, but it appears to be slower than mypy when processing a single file (at least in some cases), so there may some potential performance wins to be had there. |
I agree. Black has become a cornerstone of the Python ecosystem. If everybody just moves on to ruff, development of it would probably stall which would be unfortunate. I'd much rather see some more performance improvements, although that certainly depends on the contributors time. For now, we should still with black. -- |
@JukkaL hm, and that's interesting. Obviously run times vary from run to run, but...
And yes, it seems to use a compiled version: Pre-commit environment contents
It's on old and somewhat slow |
@sterliakov Just ran your test on my machine (M2 Macbook Pro). It took |
I ran Black directly, not via pre-commit, and I had only edited |
Anyway, this looks pretty quick -- I measured about 0.6s seconds of extra when doing an incremental pre-commit run.
"Lint GitHub Actions workflow files" feels annoyingly slow when using
Everything else is kind of reasonable. |
Didn't know that
Anything blocking this PR then? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The false positive rate looks good and performance is reasonable, so let's give this a try!
Replaces python#18387 Use codespell in pre-commit to detect spelling mistakes, see python#18642. Ignore test and typeshed folders.
Replaces python#18387 Use codespell in pre-commit to detect spelling mistakes, see python#18642. Ignore test and typeshed folders.
Replaces python#18387 Use codespell in pre-commit to detect spelling mistakes, see python#18642. Ignore test and typeshed folders.
Replaces #18387
Use codespell in pre-commit to detect spelling mistakes, see #18642. Ignore test and typeshed folders.