Skip to content

Instantly share code, notes, and snippets.

@atugushev
Last active May 12, 2020 15:32
Show Gist options
  • Select an option

  • Save atugushev/6e67bdbb1ab41045a166d79b2dc01ed4 to your computer and use it in GitHub Desktop.

Select an option

Save atugushev/6e67bdbb1ab41045a166d79b2dc01ed4 to your computer and use it in GitHub Desktop.
pip-tools pre-commit postmortem
  1. After pytest-style-plugin being added I've run pre-commit and got this result:
black....................................................................Passed
isort....................................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/Users/albert/.pyenv/versions/3.8.0/lib/python3.8/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/Users/albert/.pyenv/versions/3.8.0/lib/python3.8/multiprocessing/pool.py", line 48, in mapstar
    return list(map(*args))
  File "/Users/albert/.cache/pre-commit/repo8iv7mhhh/py_env-python3/lib/python3.8/site-packages/flake8/checker.py", line 669, in _run_checks
    return checker.run_checks()
  File "/Users/albert/.cache/pre-commit/repo8iv7mhhh/py_env-python3/lib/python3.8/site-packages/flake8/checker.py", line 608, in run_checks
    self.run_ast_checks()
  File "/Users/albert/.cache/pre-commit/repo8iv7mhhh/py_env-python3/lib/python3.8/site-packages/flake8/checker.py", line 504, in run_ast_checks
    for (line_number, offset, text, check) in runner:
  File "/Users/albert/.cache/pre-commit/repo8iv7mhhh/py_env-python3/lib/python3.8/site-packages/flake8_plugin_utils/plugin.py", line 78, in run
    visitor = self._create_visitor(visitor_cls)
  File "/Users/albert/.cache/pre-commit/repo8iv7mhhh/py_env-python3/lib/python3.8/site-packages/flake8_plugin_utils/plugin.py", line 105, in _create_visitor
    if cls.config is None:
AttributeError: type object 'PytestStylePlugin' has no attribute 'config'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/albert/.cache/pre-commit/repo8iv7mhhh/py_env-python3/bin/flake8", line 8, in <module>
    sys.exit(main())
  File "/Users/albert/.cache/pre-commit/repo8iv7mhhh/py_env-python3/lib/python3.8/site-packages/flake8/main/cli.py", line 18, in main
    app.run(argv)
  File "/Users/albert/.cache/pre-commit/repo8iv7mhhh/py_env-python3/lib/python3.8/site-packages/flake8/main/application.py", line 394, in run
    self._run(argv)
  File "/Users/albert/.cache/pre-commit/repo8iv7mhhh/py_env-python3/lib/python3.8/site-packages/flake8/main/application.py", line 382, in _run
    self.run_checks()
  File "/Users/albert/.cache/pre-commit/repo8iv7mhhh/py_env-python3/lib/python3.8/site-packages/flake8/main/application.py", line 301, in run_checks
    self.file_checker_manager.run()
  File "/Users/albert/.cache/pre-commit/repo8iv7mhhh/py_env-python3/lib/python3.8/site-packages/flake8/checker.py", line 328, in run
    self.run_parallel()
  File "/Users/albert/.cache/pre-commit/repo8iv7mhhh/py_env-python3/lib/python3.8/site-packages/flake8/checker.py", line 292, in run_parallel
    for ret in pool_map:
  File "/Users/albert/.pyenv/versions/3.8.0/lib/python3.8/multiprocessing/pool.py", line 448, in <genexpr>
    return (item for chunk in result for item in chunk)
  File "/Users/albert/.pyenv/versions/3.8.0/lib/python3.8/multiprocessing/pool.py", line 865, in next
    raise value
AttributeError: type object 'PytestStylePlugin' has no attribute 'config'

bandit...................................................................Passed
  1. Then I run rm -fr /Users/albert/.cache/pre-commit/repo8iv7mhhh

  2. After that I run pre-commit run again:

[INFO] Installing environment for https://gitlab.com/pycqa/flake8.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/Users/albert/.cache/pre-commit/repo8iv7mhhh/py_env-python3/bin/python', '-mpip', 'install', '.', 'flake8-pytest-style')
return code: 1
expected return code: 0
stdout: (none)
stderr:
    ERROR: Directory '.' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.
    WARNING: You are using pip version 20.0.2; however, version 20.1 is available.
    You should consider upgrading via the '/Users/albert/.cache/pre-commit/repo8iv7mhhh/py_env-python3/bin/python -m pip install --upgrade pip' command.

Check the log at /Users/albert/.cache/pre-commit/pre-commit.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment