Skip to content

Eventual deprecation of flake8 #344

Closed

Description

@asottile

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

Activity

  1. rpdelaney commented on Dec 23, 2018

    @rpdelaney
    Contributor

    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?

  2. asottile commented on Dec 23, 2018

    @asottile
    MemberAuthor

    Eventually yes. I myself am holding off until I release a tagged version of flake8 (probably 3.7.0) so autoupdate works better.

  3. asottile commented on Jan 31, 2019

    @asottile
    MemberAuthor

    flake8 has been released so now tags resolve on https://gitlab.com/pycqa/flake8

    For instance:

    -   repo: https://gitlab.com/pycqa/flake8
        rev: 3.7.3
        hooks:
        -   id: flake8

    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:

    python -m all_repos.autofix.pre_commit_flake8_migrate --repos path/to/repo
    

    Sample PR:

    https://github.com/pre-commit/pre-commit/pull/928/files

  4. added a commit that references this issue on Jan 31, 2019
  5. xiaotianq commented on Jul 12, 2019

    @xiaotianq

    Hi, asottile. Is there any args: configurable setting to flake8?
    Like max-line-length etc

  6. asottile commented on Jul 12, 2019

    @asottile
    MemberAuthor

    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.cfg with a [flake8] section so other invocations can use that as well

  7. xiaotianq commented on Jul 13, 2019

    @xiaotianq

    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.

  8. asottile commented on Jul 13, 2019

    @asottile
    MemberAuthor

    flake8 --help or the flake8 docs can give you a full list of arguments

    You'd put a setup.cfg (or tox.ini or .flake8) adjacent to your .pre-commit-config.yaml

  9. xiaotianq commented on Jul 13, 2019

    @xiaotianq

    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.

  10. asottile commented on Jul 13, 2019

    @asottile
    MemberAuthor

    No problem, it might be easier / quicker to follow up in my twitch discord (there's a #pre-commit channel)

  11. deleted a comment from xiaotianq on Jul 16, 2019
  12. deleted a comment from xiaotianq on Jul 16, 2019
  13. deleted a comment from xiaotianq on Jul 16, 2019
  14. deleted a comment from xiaotianq on Jul 16, 2019
  15. deleted a comment from xiaotianq on Jul 16, 2019
  16. 2 remaining items

  17. deleted a comment from xiaotianq on Jul 16, 2019
  18. deleted a comment from xiaotianq on Jul 16, 2019
  19. deleted a comment from xiaotianq on Jul 16, 2019
  20. deleted a comment from xiaotianq on Jul 16, 2019
  21. deleted a comment from xiaotianq on Jul 16, 2019
  22. ssbarnea commented on Aug 4, 2019

    @ssbarnea
    Contributor

    (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.

  23. asottile commented on Aug 4, 2019

    @asottile
    MemberAuthor

    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.

  24. ssbarnea commented on Aug 5, 2019

    @ssbarnea
    Contributor

    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.

  25. asottile commented on Aug 5, 2019

    @asottile
    MemberAuthor

    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

  26. asottile commented on Feb 5, 2020

    @asottile
    MemberAuthor

    v2.5.0 has been released containing the "soft" deprecation (the name of the hook has changed and the README has been updated)

  27. lucinvitae commented on Feb 3, 2023

    @lucinvitae

    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:

    - repo: https://github.com/pycqa/flake8
      rev: 6.0.0
      hooks:
      - id: flake8
  28. locked as off topic and limited conversation to collaborators on Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions