From 13195c3d726d236de1b82ece42955e74ca7b8711 Mon Sep 17 00:00:00 2001 From: Teo Zosa Date: Mon, 11 Oct 2021 12:58:40 -0700 Subject: [PATCH] :cookie: :green_heart: Fix `flakehell` error: `flake8` `4.0.0` compatibility issues see: flakehell/flakehell#19 Error log: ``` [INFO] Installing environment for https://github.com/flakehell/flakehell. [INFO] Once installed this environment will be reused. [INFO] This may take a few minutes... An unexpected error has occurred: CalledProcessError: command: ('/home/runner/.cache/pre-commit/repon2u8h4ar/py_env-python3.9/bin/python', '-mpip', 'install', '.') return code: 1 expected return code: 0 stdout: Processing /home/runner/.cache/pre-commit/repon2u8h4ar Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'done' Installing backend dependencies: started Installing backend dependencies: finished with status 'done' Preparing wheel metadata: started Preparing wheel metadata: finished with status 'error' stderr: DEPRECATION: A future pip version will change local packages to be built in-place without first copying to a temporary directory. We recommend you use --use-feature=in-tree-build to test your packages with this new behavior before it becomes the default. pip 21.3 will remove support for this functionality. You can find discussion regarding this at https://github.com/pypa/pip/issues/7555. ERROR: Command errored out with exit status 1: command: /home/runner/.cache/pre-commit/repon2u8h4ar/py_env-python3.9/bin/python /home/runner/.cache/pre-commit/repon2u8h4ar/py_env-python3.9/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /tmp/tmp6kspbrcm cwd: /tmp/pip-req-build-7fx4ywsx Complete output (36 lines): Traceback (most recent call last): File "/home/runner/.cache/pre-commit/repon2u8h4ar/py_env-python3.9/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 349, in main() File "/home/runner/.cache/pre-commit/repon2u8h4ar/py_env-python3.9/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 331, in main json_out['return_val'] = hook(**hook_input['kwargs']) File "/home/runner/.cache/pre-commit/repon2u8h4ar/py_env-python3.9/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 151, in prepare_metadata_for_build_wheel return hook(metadata_directory, config_settings) File "/tmp/pip-build-env-0s2_gtp1/overlay/lib/python3.9/site-packages/flit_core/buildapi.py", line 49, in prepare_metadata_for_build_wheel metadata = make_metadata(module, ini_info) File "/tmp/pip-build-env-0s2_gtp1/overlay/lib/python3.9/site-packages/flit_core/common.py", line 392, in make_metadata md_dict.update(get_info_from_module(module, ini_info.dynamic_metadata)) File "/tmp/pip-build-env-0s2_gtp1/overlay/lib/python3.9/site-packages/flit_core/common.py", line 189, in get_info_from_module docstring, version = get_docstring_and_version_via_import(target) File "/tmp/pip-build-env-0s2_gtp1/overlay/lib/python3.9/site-packages/flit_core/common.py", line 165, in get_docstring_and_version_via_import m = sl.load_module() File "", line 529, in _check_name_wrapper File "", line 1029, in load_module File "", line 854, in load_module File "", line 274, in _load_module_shim File "", line 711, in _load File "", line 680, in _load_unlocked File "", line 850, in exec_module File "", line 228, in _call_with_frames_removed File "/tmp/pip-req-build-7fx4ywsx/flakehell/__init__.py", line 5, in from ._cli import entrypoint, flake8_entrypoint File "/tmp/pip-req-build-7fx4ywsx/flakehell/_cli.py", line 9, in from .commands import COMMANDS File "/tmp/pip-req-build-7fx4ywsx/flakehell/commands/__init__.py", line 5, in from ._baseline import baseline_command File "/tmp/pip-req-build-7fx4ywsx/flakehell/commands/_baseline.py", line 6, in from .._patched import FlakeHellApplication File "/tmp/pip-req-build-7fx4ywsx/flakehell/_patched/__init__.py", line 2, in from ._app import FlakeHellApplication File "/tmp/pip-req-build-7fx4ywsx/flakehell/_patched/_app.py", line 10, in from flake8.options.config import MergedConfigParser, get_local_plugins ImportError: cannot import name 'MergedConfigParser' from 'flake8.options.config' (/tmp/pip-build-env-0s2_gtp1/normal/lib/python3.9/site-packages/flake8/options/config.py) ---------------------------------------- WARNING: Discarding file:///home/runner/.cache/pre-commit/repon2u8h4ar. Command errored out with exit status 1: /home/runner/.cache/pre-commit/repon2u8h4ar/py_env-python3.9/bin/python /home/runner/.cache/pre-commit/repon2u8h4ar/py_env-python3.9/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /tmp/tmp6kspbrcm Check the logs for full command output. ERROR: Command errored out with exit status 1: /home/runner/.cache/pre-commit/repon2u8h4ar/py_env-python3.9/bin/python /home/runner/.cache/pre-commit/repon2u8h4ar/py_env-python3.9/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /tmp/tmp6kspbrcm Check the logs for full command output. Check the log at /home/runner/.cache/pre-commit/pre-commit.log ERROR: InvocationError for command /home/runner/work/cookiecutter-cruft-poetry-tox-pre-commit-ci-cd/cookiecutter-cruft-poetry-tox-pre-commit-ci-cd/.tox/precommit/bin/pre-commit run -vv --all-files --color always (exited with code 3) ___________________________________ summary ____________________________________ ERROR: precommit: commands failed ``` --- .pre-commit-config.yaml | 8 ++++++-- poetry.lock | 35 ++++++++++++++++------------------- pyproject.toml | 1 + 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e16759f73..7acb1bb2a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,15 +21,19 @@ repos: - id: detect-secrets exclude: poetry.lock - - repo: https://github.com/flakehell/flakehell - rev: v.0.8.0 + - repo: local hooks: - id: flakehell + name: flakehell + language: system + types: ["file", "text"] + files: \.(ipynb|md|py|rst|yaml|yml)$ # False-positives from cookiecutter Jinja2 template syntax => # print output but always succeed. # see: https://stackoverflow.com/a/59745587 verbose: true entry: bash -c 'flakehell lint "$@" || true' -- + require_serial: True - repo: https://github.com/timothycrosley/isort rev: 5.9.3 diff --git a/poetry.lock b/poetry.lock index 0180105ee..2a312eaca 100644 --- a/poetry.lock +++ b/poetry.lock @@ -131,10 +131,7 @@ pathspec = ">=0.9.0,<1" platformdirs = ">=2" regex = ">=2020.1.8" tomli = ">=0.2.6,<2.0.0" -typing-extensions = [ - {version = ">=3.10.0.0", markers = "python_version < \"3.10\""}, - {version = "!=3.10.0.1", markers = "python_version >= \"3.10\""}, -] +typing-extensions = ">=3.10.0.0" [package.extras] colorama = ["colorama (>=0.4.3)"] @@ -388,16 +385,16 @@ testing = ["covdefaults (>=1.2.0)", "coverage (>=4)", "pytest (>=4)", "pytest-co [[package]] name = "flake8" -version = "4.0.1" +version = "3.9.2" description = "the modular source code checker: pep8 pyflakes and co" category = "dev" optional = false -python-versions = ">=3.6" +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" [package.dependencies] mccabe = ">=0.6.0,<0.7.0" -pycodestyle = ">=2.8.0,<2.9.0" -pyflakes = ">=2.4.0,<2.5.0" +pycodestyle = ">=2.7.0,<2.8.0" +pyflakes = ">=2.3.0,<2.4.0" [[package]] name = "flakehell" @@ -1109,11 +1106,11 @@ global = ["pybind11-global (==2.8.0)"] [[package]] name = "pycodestyle" -version = "2.8.0" +version = "2.7.0" description = "Python style guide checker" category = "dev" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" [[package]] name = "pycparser" @@ -1125,7 +1122,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" [[package]] name = "pyflakes" -version = "2.4.0" +version = "2.3.1" description = "passive checker of Python programs" category = "dev" optional = false @@ -1913,8 +1910,8 @@ docs = ["emoji", "myst-parser", "pygments", "sphinx", "sphinx-autodoc-typehints" [metadata] lock-version = "1.1" -python-versions = "^3.8" -content-hash = "e5a10d924397e0960acef7053e8b22e801c8426de19e138ba2650bf75f12dc1c" +python-versions = "^3.8,<3.9" +content-hash = "cad25407a7fa007a603895dc5654aa8462eeacce3e3500a7f9ef768e8bebd68a" [metadata.files] alabaster = [ @@ -2164,8 +2161,8 @@ filelock = [ {file = "filelock-3.3.0.tar.gz", hash = "sha256:8c7eab13dc442dc249e95158bcc12dec724465919bdc9831fdbf0660f03d1785"}, ] flake8 = [ - {file = "flake8-4.0.1-py2.py3-none-any.whl", hash = "sha256:479b1304f72536a55948cb40a32dce8bb0ffe3501e26eaf292c7e60eb5e0428d"}, - {file = "flake8-4.0.1.tar.gz", hash = "sha256:806e034dda44114815e23c16ef92f95c91e4c71100ff52813adf7132a6ad870d"}, + {file = "flake8-3.9.2-py2.py3-none-any.whl", hash = "sha256:bf8fd333346d844f616e8d47905ef3a3384edae6b4e9beb0c5101e25e3110907"}, + {file = "flake8-3.9.2.tar.gz", hash = "sha256:07528381786f2a6237b061f6e96610a4167b226cb926e2aa2b6b1d78057c576b"}, ] flakehell = [ {file = "flakehell-0.9.0-py3-none-any.whl", hash = "sha256:48a3a9b46136240e52b3b32a78a0826c45f6dcf7d980c30f758c1db5b1439c0b"}, @@ -2489,16 +2486,16 @@ pybind11 = [ {file = "pybind11-2.8.0.tar.gz", hash = "sha256:58e866369d184fdefb468377773a8bc707267a553039198b15309679bbc0a3f6"}, ] pycodestyle = [ - {file = "pycodestyle-2.8.0-py2.py3-none-any.whl", hash = "sha256:720f8b39dde8b293825e7ff02c475f3077124006db4f440dcbc9a20b76548a20"}, - {file = "pycodestyle-2.8.0.tar.gz", hash = "sha256:eddd5847ef438ea1c7870ca7eb78a9d47ce0cdb4851a5523949f2601d0cbbe7f"}, + {file = "pycodestyle-2.7.0-py2.py3-none-any.whl", hash = "sha256:514f76d918fcc0b55c6680472f0a37970994e07bbb80725808c17089be302068"}, + {file = "pycodestyle-2.7.0.tar.gz", hash = "sha256:c389c1d06bf7904078ca03399a4816f974a1d590090fecea0c63ec26ebaf1cef"}, ] pycparser = [ {file = "pycparser-2.20-py2.py3-none-any.whl", hash = "sha256:7582ad22678f0fcd81102833f60ef8d0e57288b6b5fb00323d101be910e35705"}, {file = "pycparser-2.20.tar.gz", hash = "sha256:2d475327684562c3a96cc71adf7dc8c4f0565175cf86b6d7a404ff4c771f15f0"}, ] pyflakes = [ - {file = "pyflakes-2.4.0-py2.py3-none-any.whl", hash = "sha256:3bb3a3f256f4b7968c9c788781e4ff07dce46bdf12339dcda61053375426ee2e"}, - {file = "pyflakes-2.4.0.tar.gz", hash = "sha256:05a85c2872edf37a4ed30b0cce2f6093e1d0581f8c19d7393122da7e25b2b24c"}, + {file = "pyflakes-2.3.1-py2.py3-none-any.whl", hash = "sha256:7893783d01b8a89811dd72d7dfd4d84ff098e5eed95cfa8905b22bbffe52efc3"}, + {file = "pyflakes-2.3.1.tar.gz", hash = "sha256:f5bc8ecabc05bb9d291eb5203d6810b49040f6ff446a756326104746cc00c1db"}, ] pygal = [ {file = "pygal-2.4.0-py2.py3-none-any.whl", hash = "sha256:27abab93cbc31e21f3c6bdecc05bda6cd3570cbdbd8297b7caa6904051b50d72"}, diff --git a/pyproject.toml b/pyproject.toml index 4db8fc074..ae218d5a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -85,6 +85,7 @@ tox = "^3.24.4" black = "^21.9b0" # see: https://black.readthedocs.io/en/stable/editor_integration.html ## Code quality flakehell = "^0.9.0" +flake8 = "^3.9.0" pylint = "^2.11.1" ## Automation and management pre-commit = "^2.15.0"