pre-commit-ci / issues

public issues for https://pre-commit.ci
16 stars 3 forks source link

pre-commit hangs, maybe due to new flake8 #118

Closed fepegar closed 2 years ago

fepegar commented 2 years ago

This happens on CI but I think also locally when using flake8 4.0.1. I managed to reproduce this locally running:

conda create -n test python=3.9 -y && conda activate test
mkdir folder && cd folder
pip install pre-commit
cp ~/git/torchio/.pre-commit-config.yaml
[change flake8 version to 4.0.1]  # Note this is not a real command!
echo "print(x)" > file.py
git init .
git add file.py
pre-commit install
pre-commit run --all-files --verbose  # hangs (or takes very long!)

PR created by pre-commit-ci

Build https://results.pre-commit.ci/run/github/224148738/1649695083._kULwOBYTwK87Bmv9fY30w

Config diff in PR https://github.com/fepegar/torchio/pull/859/files

Originally mentioned in

Maybe related to

asottile commented 2 years ago

it looks like you've got quite the list of plugins -- one of those is incompatible with flake8 4.x:

$ cat t.txt 
flake8==4.0.1
flake8-blind-except
flake8-breakpoint
flake8-broken-line
flake8-bugbear
flake8-builtins
flake8-class-newline
flake8-comprehensions
flake8-debugger
flake8-fixme
flake8-logging-format
flake8-markdown
flake8-pep3101
flake8-polyfill
flake8-print
flake8-type-annotations
flake8-use-fstring
flake8-2020
pep8-naming
$ venv/bin/pip install -r t.txt 
Collecting flake8==4.0.1
  Using cached flake8-4.0.1-py2.py3-none-any.whl (64 kB)
Collecting flake8-blind-except
  Downloading flake8-blind-except-0.2.1.tar.gz (3.7 kB)
  Preparing metadata (setup.py) ... done
Collecting flake8-breakpoint
  Downloading flake8_breakpoint-1.1.0-py3-none-any.whl (5.1 kB)
Collecting flake8-broken-line
  Downloading flake8_broken_line-0.4.0-py3-none-any.whl (4.2 kB)
Collecting flake8-bugbear
  Downloading flake8_bugbear-22.3.23-py3-none-any.whl (19 kB)
Collecting flake8-builtins
  Downloading flake8_builtins-1.5.3-py2.py3-none-any.whl (12 kB)
Collecting flake8-class-newline
  Downloading flake8_class_newline-1.6.0-py3-none-any.whl (5.2 kB)
Collecting flake8-comprehensions
  Downloading flake8_comprehensions-3.8.0-py3-none-any.whl (6.6 kB)
Collecting flake8-debugger
  Downloading flake8_debugger-4.0.0-py3-none-any.whl (5.0 kB)
Collecting flake8-fixme
  Downloading flake8_fixme-1.1.1-py2.py3-none-any.whl (8.0 kB)
Collecting flake8-logging-format
  Downloading flake8-logging-format-0.6.0.tar.gz (5.1 kB)
  Preparing metadata (setup.py) ... done
Collecting flake8-markdown
  Downloading flake8_markdown-0.3.0-py3-none-any.whl (6.3 kB)
Collecting flake8-pep3101
  Downloading flake8_pep3101-1.3.0-py2.py3-none-any.whl (11 kB)
Collecting flake8-polyfill
  Downloading flake8_polyfill-1.0.2-py2.py3-none-any.whl (7.3 kB)
Collecting flake8-print
  Downloading flake8_print-4.0.0-py3-none-any.whl (4.9 kB)
Collecting flake8-type-annotations
  Downloading flake8_type_annotations-0.1.0-py3-none-any.whl (6.9 kB)
Collecting flake8-use-fstring
  Downloading flake8-use-fstring-1.3.tar.gz (5.4 kB)
  Preparing metadata (setup.py) ... done
Collecting flake8-2020
  Downloading flake8_2020-1.6.1-py2.py3-none-any.whl (5.1 kB)
Collecting pep8-naming
  Downloading pep8_naming-0.12.1-py2.py3-none-any.whl (8.9 kB)
Collecting pycodestyle<2.9.0,>=2.8.0
  Using cached pycodestyle-2.8.0-py2.py3-none-any.whl (42 kB)
Collecting mccabe<0.7.0,>=0.6.0
  Using cached mccabe-0.6.1-py2.py3-none-any.whl (8.6 kB)
Collecting pyflakes<2.5.0,>=2.4.0
  Using cached pyflakes-2.4.0-py2.py3-none-any.whl (69 kB)
Collecting flake8-plugin-utils<2.0,>=1.0
  Downloading flake8_plugin_utils-1.3.2-py3-none-any.whl (9.4 kB)
Collecting attrs>=19.2.0
  Using cached attrs-21.4.0-py2.py3-none-any.whl (60 kB)
Collecting six
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
INFO: pip is looking at multiple versions of flake8-print to determine which version is compatible with other requirements. This could take a while.
Collecting flake8-print
  Downloading flake8-print-3.1.4.tar.gz (4.2 kB)
  Preparing metadata (setup.py) ... done
  Downloading flake8-print-3.1.3.tar.gz (4.1 kB)
  Preparing metadata (setup.py) ... done
  Downloading flake8_print-3.1.1-py2.py3-none-any.whl (4.7 kB)
  Downloading flake8-print-3.1.0.tar.gz (3.7 kB)
  Preparing metadata (setup.py) ... done
  Downloading flake8-print-3.0.1.tar.gz (3.6 kB)
^C  Preparing metadata (setup.py) ... canceled

pip is iteratively trying to resolve a conflict and then eventually timing out as it doesn't find a satisfiable version

you can find more about this issue here: https://github.com/PyCQA/flake8/issues/1409 -- though I suspect the correct place to report a bug is to whatever plugin has the incorrect constraints

you can probably fix this by removing that plugin (and others that conflict, it looks like flake8-3101 also conflicts)

asottile commented 2 years ago

actually -- looks like the only one which conflicts is flake8-type-annotations -- if you remove that it should be good

you might be able to trim your list a bit as well:

fepegar commented 2 years ago

Awesome, thanks a lot for all the detailed information!

asottile commented 2 years ago

oh and flake8-type-annotations is obsolete anyway according to their README: https://github.com/sobolevn/flake8-type-annotations

fepegar commented 2 years ago

All good now: https://results.pre-commit.ci/run/github/224148738/1649711627.UNoQX5K2Rdi1SydcqBWJQg

Thanks again!