Skip to content

Flakehell fails with pre-commit #19

Open

Description

@KPLauritzen

After flake8 has released version 4.0.0, it is no longer possible to install flakehell as a pre-commit hook.

An example .pre-commit-config.yaml:

repos:
  - repo: https://github.com/flakehell/flakehell
    rev: v.0.8.0
    hooks:
      - id: flakehell

will install flake8==4.0.0 and immediately fail. See #18 .

Specifying a specific version of flake8 does not work. E.g.

repos:
  - repo: https://github.com/flakehell/flakehell
    rev: v.0.8.0
    hooks:
      - id: flakehell
        additional_dependencies:
          - flake8==3.9.0

will fail with exactly the same error. I'm not sure if pre-commit is just ignoring the pinned version, or something else is going on.

The error has crippled my CI/CD pipelines and the only fix I can think of is to switch back to flake8.

Activity

  1. KPLauritzen commented on Oct 11, 2021

    @KPLauritzen
    Author

    Could be related to a bug in pip, regarding how depencies are resolved.
    See discussion here pypa/pip#10568
    and loose dependency specified here https://github.com/flakehell/flakehell/blob/master/pyproject.toml#L70

  2. uSpike commented on Oct 11, 2021

    @uSpike

    The workaround that I just deployed for our project:
    poetry add --dev flakehell, then update .pre-commit-config.yaml:

      - repo: local
        hooks:
          - id: flakehell
            name: flakehell
            language: system
            types: ["file", "text"]
            files: \.(ipynb|md|py|rst|yaml|yml)$
            entry: poetry run flakehell lint
            require_serial: True
  3. KPLauritzen commented on Oct 12, 2021

    @KPLauritzen
    Author

    I pinned the flake8 version inside flakehell, as in #20 and I'm using my own fork until this one is updated.

    repos:
      - repo: https://github.com/KPLauritzen/flakehell
        rev: d644612
        hooks:
          - id: flakehell
            additional_dependencies:
              - flake8==3.9.0
  4. mario-bermonti commented on Oct 14, 2021

    @mario-bermonti

    I pinned the flake8 version inside flakehell, as in #20 and I'm using my own fork until this one is updated.

    repos:
      - repo: https://github.com/KPLauritzen/flakehell
        rev: d644612
        hooks:
          - id: flakehell
            additional_dependencies:
              - flake8==3.9.0

    This worked for me!

  5. deleted a comment from mcarans on Jan 12, 2022
  6. sgaynetdinov commented on Jan 12, 2022

    @sgaynetdinov
    Contributor

    @mario-bermonti @KPLauritzen I am already studying the problem and the proposed PR

    @mcarans please do not use this repository to promote another repository

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