Skip to content
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

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

Closed
fepegar opened this issue Apr 11, 2022 · 5 comments
Closed

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

fepegar opened this issue Apr 11, 2022 · 5 comments

Comments

@fepegar
Copy link

fepegar commented Apr 11, 2022

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
Copy link
Member

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: PyCQA/flake8#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
Copy link
Member

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:

  • flake8-blind-except: pycodestyle has a built in check for except: that's on by default
  • flake8-breakpoint: you can probably replace with pre-commit/pre-commit-hooks: debug-statements
  • flake8-comprehensions: can probably replace with pyupgrade
  • flake8-debugger: also can be replaced with debug-statements
  • flake8-polyfill: not actually a flake8 plugin, can be removed (it was flake8 2.x compat code)

@fepegar
Copy link
Author

fepegar commented Apr 11, 2022

Awesome, thanks a lot for all the detailed information!

@asottile
Copy link
Member

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

fepegar added a commit to fepegar/torchio that referenced this issue Apr 11, 2022
This commit address the comments by @asottile in
pre-commit-ci/issues#118.

Thanks, @asottile!
@fepegar
Copy link
Author

fepegar commented Apr 11, 2022

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

Thanks again!

fepegar added a commit to fepegar/torchio that referenced this issue Apr 11, 2022
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/pre-commit/pre-commit-hooks: v4.0.1 → v4.2.0](pre-commit/pre-commit-hooks@v4.0.1...v4.2.0)
- [github.com/pycqa/flake8: 3.9.2 → 4.0.1](PyCQA/flake8@3.9.2...4.0.1)
- [github.com/asottile/pyupgrade: v2.29.0 → v2.32.0](asottile/pyupgrade@v2.29.0...v2.32.0)

* Fix pre-commit not installing flake8

This commit address the comments by @asottile in
pre-commit-ci/issues#118.

Thanks, @asottile!

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fernando Pérez-García <fepegar@gmail.com>
justusschock added a commit to justusschock/torchio that referenced this issue Jun 28, 2022
Use type of current instance instead of hardcoded subject type

fix copy behavior

Stop running some unstable tests on CI (fepegar#796)

* Print output messages during testing

* Skip MedMNIST tests on GitHub Actions

* Fix AttributeError

* Add reason for skipping test

Add support to specify the interpolation type for label images (fepegar#791)

* Add label_interpolation option in spatial transforms and augmentations

* Add label_interpolation option in spatial transforms and augmentations

* Adds missing backtick

* update docs 782

* Minor docs edits

Co-authored-by: Fernando Pérez-García <fepegar@gmail.com>

docs: add snavalm as a contributor for code (fepegar#802)

* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>

Bump version: 0.18.71 → 0.18.72

Add py.typed marker file for type checking (fepegar#808)

docs: add jcreinhold as a contributor for code (fepegar#809)

* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>

Bump version: 0.18.72 → 0.18.73

Fix overlapping in patches aggregator (fepegar#832)

Bump version: 0.18.73 → 0.18.74

Update announcement

docs: add Hsuxu as a contributor for bug (fepegar#833)

* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>

Add check for shapes of input batch and output location

Add support for torch >= 1.11 (fepegar#838)

* added support for pytorch>=1.11.0

* Replace type with isinstance

Co-authored-by: Fernando Pérez-García <fepegar@gmail.com>

Bump version: 0.18.74 → 0.18.75

docs: add snipdome as a contributor for bug (fepegar#839)

* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>

Remove redundant tests in GitHub actions (fepegar#850)

Fix new SimpleITK release breaking tests (fepegar#852)

Bump version: 0.18.75 → 0.18.76

Disable fail-fast in CI matrix strategy

Fix wrong mapping in SequentialLabels transform (fepegar#841)

docs: add iamSmallY as a contributor for bug (fepegar#855)

* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>

Fix SimpleITK version in docs requirements

Fix examples format in docstrings

Improve documentation and tests for label transforms (fepegar#857)

* Improve documentation and tests for label transforms

* Add parametrization with duplicated values in dict

Add example of RandomLabelsToImage

Add example of RandomGamma

Use sphinx-opengraph for documentation

Improve quality of figures from plot directive

[pre-commit.ci] pre-commit autoupdate (fepegar#859)

* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/pre-commit/pre-commit-hooks: v4.0.1 → v4.2.0](pre-commit/pre-commit-hooks@v4.0.1...v4.2.0)
- [github.com/pycqa/flake8: 3.9.2 → 4.0.1](PyCQA/flake8@3.9.2...4.0.1)
- [github.com/asottile/pyupgrade: v2.29.0 → v2.32.0](asottile/pyupgrade@v2.29.0...v2.32.0)

* Fix pre-commit not installing flake8

This commit address the comments by @asottile in
pre-commit-ci/issues#118.

Thanks, @asottile!

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fernando Pérez-García <fepegar@gmail.com>

Validate arguments of add/remove_image

Return figure in plot_volume function (fepegar#872)

Co-authored-by: Derk <derk@mriguidance.com>

docs: add guigautier as a contributor for ideas (fepegar#875)

* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>

Update flake8 error codes

[pre-commit.ci] pre-commit autoupdate (fepegar#874)

updates:
- [github.com/asottile/pyupgrade: v2.32.0 → v2.32.1](asottile/pyupgrade@v2.32.0...v2.32.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fernando Pérez-García <fperezgarcia@microsoft.com>

Stop upgrading pip in CI (fepegar#877)

Update bug report template

docs: add AyedSamy as a contributor for bug (fepegar#878)

* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>

Add tests for Python 3.10 (fepegar#880)

* Add tests for Python 3.10

* Fix Python version in YAML

Use PyTorch to compute Fourier transforms (fepegar#389)

* Use PyTorch for FFT if available

* Make sure tensor in on CPU before calling numpy()

Remove support for Python 3.6 (fepegar#881)

* Remove support for Python 3.6

* Fix Python version

Add support to use different numbers of samples in the queue (fepegar#795)

docs: add jmlipman as a contributor for ideas, code (fepegar#882)

* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
Co-authored-by: Juan Miguel <regjmlipman@hotmail.com>

Fix computation of kernels in `Blur` transform (fepegar#861)

* Fix size of Gaussian kernel for blurring

* Fix typo in docstring

Add support to pass label keys for dict input (fepegar#879)

* Add support to pass label keys for dict input

* Add reference to @josegcpa's code

Co-authored-by: josegcpa <josegcpa@ebi.ac.uk>

docs: add josegcpa as a contributor for ideas (fepegar#883)

* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>

Bump version: 0.18.76 → 0.18.77

Fix support for NiBabel inputs

Remove unnecessary check

Remove error for multichannel NiBabel input

Cover method to print queue memory

Add gallery example for custom resampling transform

docs: add saikhu as a contributor for bug (fepegar#887)

* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>

Move package code to `src` directory (fepegar#896)

* Move package to src directory

* Update setup.py

* Update setup.py

* Move requirements

* Include requirements file in MANIFEST.in

* Stop using requirements file

* Fix warning in docs

Remove setup.py script and add pyproject.toml config file (fepegar#898)

* Remove setup.py and add pyproject.toml

* Add version to setup config

* Remove bumpversion config for setup.py

* Fix path to __init__

* Stop removing trailing whitespaces from setup.cfg

See peritus/bumpversion#78

* Update version replacing in bumpversion config

* Fix tox configuration for pyproject.toml

* Add keywords

* Remove requirements file

* Update authors config

Bump version: 0.18.77 → 0.18.78

Enable verbose mode for publishing GHA

Fix version

Fix version not being updated

As it seems that bump2version is not able to modify its own config file.

Add citation file

[pre-commit.ci] pre-commit autoupdate (fepegar#902)

updates:
- [github.com/pre-commit/pre-commit-hooks: v4.2.0 → v4.3.0](pre-commit/pre-commit-hooks@v4.2.0...v4.3.0)
- [github.com/asottile/pyupgrade: v2.32.1 → v2.34.0](asottile/pyupgrade@v2.32.1...v2.34.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

Fix warning in RTD documentation build (fepegar#903)

Add hook for trailing commas (fepegar#904)

* Add hook for trailing commas

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix flake8 issues

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

Disable Binder buttons in Sphinx gallery (fepegar#905)

* Disable Binder buttons in Sphinx gallery

* Update RTD config to use pip installation

* Fix extra requirements string

* Add missing doc requirement

Add checks for TOML and YAML files

Add support to mask 4D images with 3D masks (fepegar#908)

* Add failing test

* Add support to mask 4D images with 3D masks

* Improve docstring

Co-authored-by: cbri92 <70302171+cbri92@users.noreply.github.com>
Co-authored-by: valabregue <romain.valabregue@upmc.fr>

docs: add cbri92 as a contributor for bug (fepegar#909)

* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>

Bump version: 0.18.78 → 0.18.79

Add fftshift to fourier_transform with torch.fft (fepegar#912)

This makes the behavior of fourier_transform and inv_fourier_transform
consistent with earlier versions of torchio. It is also independent of
whether torch or numpy is used to perform the transform.

Solves fepegar#911

docs: add iimog as a contributor for bug (fepegar#913)

* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>

Bump version: 0.18.79 → 0.18.80

Remove incorrect Contributors badge

Stop ignoring some missing imports for mypy

Fix tox running on Python 3.7 only (fepegar#915)

Create dependabot.yml (fepegar#917)

Test all Python versions in Ubuntu only (fepegar#918)

* Test all Python versions in Ubuntu only

* Fix exclusions

Bump actions/setup-python from 2 to 4 (fepegar#919)

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 2 to 4.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](actions/setup-python@v2...v4)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Ignore some files in MANIFEST (fepegar#916)

* Ignore some files in MANIFEST

* Always publish to TestPyPI

* Skip existing TestPyPI versions

Bump actions/checkout from 2 to 3 (fepegar#920)

Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Update fpg.py

Proper copy of subclass copies

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

fix parenthesis

imports

Fix proper subject subclass copy

old-style type annotations

linting

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Fix proper subject subclass copy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants