Skip to content

Commit

Permalink
🍪 💚 Fix flakehell error: flake8 4.0.0 compatibility issues
Browse files Browse the repository at this point in the history
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 pypa/pip#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 <module>
            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 "<frozen importlib._bootstrap_external>", line 529, in _check_name_wrapper
          File "<frozen importlib._bootstrap_external>", line 1029, in load_module
          File "<frozen importlib._bootstrap_external>", line 854, in load_module
          File "<frozen importlib._bootstrap>", line 274, in _load_module_shim
          File "<frozen importlib._bootstrap>", line 711, in _load
          File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
          File "<frozen importlib._bootstrap_external>", line 850, in exec_module
          File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
          File "/tmp/pip-req-build-7fx4ywsx/flakehell/__init__.py", line 5, in <module>
            from ._cli import entrypoint, flake8_entrypoint
          File "/tmp/pip-req-build-7fx4ywsx/flakehell/_cli.py", line 9, in <module>
            from .commands import COMMANDS
          File "/tmp/pip-req-build-7fx4ywsx/flakehell/commands/__init__.py", line 5, in <module>
            from ._baseline import baseline_command
          File "/tmp/pip-req-build-7fx4ywsx/flakehell/commands/_baseline.py", line 6, in <module>
            from .._patched import FlakeHellApplication
          File "/tmp/pip-req-build-7fx4ywsx/flakehell/_patched/__init__.py", line 2, in <module>
            from ._app import FlakeHellApplication
          File "/tmp/pip-req-build-7fx4ywsx/flakehell/_patched/_app.py", line 10, in <module>
            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
```
  • Loading branch information
TeoZosa committed Oct 11, 2021
1 parent c240b43 commit 13195c3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
8 changes: 6 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
35 changes: 16 additions & 19 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 13195c3

Please sign in to comment.