You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
More of a heads up than anything -- not that many will see this 😆
Now that I've added a .pre-commit-hooks.yaml to the flake8 repository, we'll eventually be deprecating the flake8 hook defined here.
The rough ordering for that:
flake8 makes its next tagged release (probably 3.7.0) -- I'm not sure on the timeline for this yet, we have to fix some new parsing of per_file_ignores and then probably will wait until pycodestyle / pyflakes make a new release(s) and then go go go?
the flake8 hook will be "soft" deprecated. Probably nothing more than some messaging in the README. This will probably be pre-commit-hooks==2.X where X is some minor release greater than the current release
Further after, (pre-commit-hooks==3) flake8 will be removed as a dependency in this repository and the flake8 executable will be replaced with a stub similar to the one added when autopep8-wrapper was deprecated
The rationale for this change:
Direct access to the flake8 git repository better funnels people to raise issues in the correct place
It is easier to pin the exact version of flake8 you are using (and leverage pre-commit autoupdate to get to a newer version)
pre-commit-hooks is no longer plagued by spurious VersionConflict errors
This issue is mostly a FYI / tracking issue for those events
Reacted by Calum Lind, Chris Adams, Max Smolens, Hugo van Kemenade, Josiah Kaviani, Vladimir Iglovikov, Dan Yeaw and Wagner de Lima
Hi, asottile. Thanks for the reply. Where can I checkout the available args for flake8? Searched around but could not find any.
Are you saying I should add setup.cfg to my only hook repo?
Currently I am just using existing hook repo and passing in args.
(Updated) Multiplication of number of cloning operations due to pre-comit can cause some problems for large-scale CI systems, especially if they are not able to cache ~/.cache/pre-commit between builds. Individual builds may face rate-limiting from SaaS git providers like GitHub or GitLab.
I think you're inventing problems, I don't see gitlab / github banning clones for open source projects that would entirely defeat the purpose of the service -- please do not spread FUD without evidence.
I guess my phrasing was a big misleading, SaaS providers are not really banning cloning. What they do when too much activity happens on a single repository or from a limited number of IP addresses, is that they introduce rate limits. The side effect is that almost always these would cause build failures.
Both GitLab and GitHub have rate limits, in fact two levels: one limit for anonymous access and another limit for authenticated ones. In most cases CI runs as anonymous, which obviously has lower limits. Obviously that individuals would not be able to reach the rate limiting by themselves but CI systems can do, especially as when run in isolation, they will clone everything from zero on each build.
If users are coming here and noticing that using the above gitlab url for the flake8 hooks is causing HTTP/auth errors for you, as it did for me since I don't work with gitlab, simply switching to the github url fixes the issue:
Activity
rpdelaney commentedon Dec 23, 2018
So I should be changing all the flake8 hooks to point, instead of at github.com/pre-commit/pre-commit, instead to gitlab.com/pycqa/flake8?
asottile commentedon Dec 23, 2018
Eventually yes. I myself am holding off until I release a tagged version of flake8 (probably 3.7.0) so autoupdate works better.
asottile commentedon Jan 31, 2019
flake8 has been released so now tags resolve on https://gitlab.com/pycqa/flake8
For instance:
If you want a script which automatically migrates your repositories, I've hooked up an all-repos fixer which automatically performs this migration.
Here's the fixer: https://github.com/asottile/all-repos/blob/master/all_repos/autofix/pre_commit_flake8_migrate.py
Sample invocation:
Sample PR:
https://github.com/pre-commit/pre-commit/pull/928/files
Fix pre-commit hook for flake8
xiaotianq commentedon Jul 12, 2019
Hi, asottile. Is there any
args:configurable setting to flake8?Like
max-line-lengthetcasottile commentedon Jul 12, 2019
yeah, it's no different from how any other hook is configured.
that said, you'll often have better mileage by configurating that in
setup.cfgwith a[flake8]section so other invocations can use that as wellxiaotianq commentedon Jul 13, 2019
Hi, asottile. Thanks for the reply. Where can I checkout the available args for flake8? Searched around but could not find any.
Are you saying I should add
setup.cfgto my only hook repo?Currently I am just using existing hook repo and passing in args.
asottile commentedon Jul 13, 2019
flake8 --helpor the flake8 docs can give you a full list of argumentsYou'd put a
setup.cfg(ortox.inior.flake8) adjacent to your.pre-commit-config.yamlxiaotianq commentedon Jul 13, 2019
Hi, Anthony. Thanks for the answer. I am new to pre-commit, can not dig some answers through the docs. May there be some questions.
asottile commentedon Jul 13, 2019
No problem, it might be easier / quicker to follow up in my twitch discord (there's a #pre-commit channel)
2 remaining items
ssbarnea commentedon Aug 4, 2019
(Updated) Multiplication of number of cloning operations due to pre-comit can cause some problems for large-scale CI systems, especially if they are not able to cache
~/.cache/pre-commitbetween builds. Individual builds may face rate-limiting from SaaS git providers like GitHub or GitLab.asottile commentedon Aug 4, 2019
I think you're inventing problems, I don't see gitlab / github banning clones for open source projects that would entirely defeat the purpose of the service -- please do not spread FUD without evidence.
ssbarnea commentedon Aug 5, 2019
I guess my phrasing was a big misleading, SaaS providers are not really banning cloning. What they do when too much activity happens on a single repository or from a limited number of IP addresses, is that they introduce rate limits. The side effect is that almost always these would cause build failures.
Both GitLab and GitHub have rate limits, in fact two levels: one limit for anonymous access and another limit for authenticated ones. In most cases CI runs as anonymous, which obviously has lower limits. Obviously that individuals would not be able to reach the rate limiting by themselves but CI systems can do, especially as when run in isolation, they will clone everything from zero on each build.
This is not some kind of hypothetical concern, at OpenStack we already encountered rate limiting from github itself. Example: https://bugs.launchpad.net/tripleo/+bug/1791941 with decision to avoid any cloning from github.
asottile commentedon Aug 5, 2019
Please be careful with your phrasing, a lot of people read these issues and what you say carries weight.
I'd suggest deleting comments as they're off topic
asottile commentedon Feb 5, 2020
v2.5.0 has been released containing the "soft" deprecation (the
nameof the hook has changed and the README has been updated)Fixed flake8 usage in pre-commit
Fixed flake8 usage in pre-commit
lucinvitae commentedon Feb 3, 2023
If users are coming here and noticing that using the above gitlab url for the flake8 hooks is causing HTTP/auth errors for you, as it did for me since I don't work with gitlab, simply switching to the github url fixes the issue: