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

Drop the abandoned flake8-commas plugin from deps #2933

Open
webknjaz opened this issue Apr 24, 2024 · 2 comments
Open

Drop the abandoned flake8-commas plugin from deps #2933

webknjaz opened this issue Apr 24, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@webknjaz
Copy link
Contributor

What's wrong

pre-commit.ci updated their default runtime to Python 3.12 yesterday and here's how this plugin crashes there:

multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/lib/python3.12/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
                    ^^^^^^^^^^^^^^^^^^^
  File "/pc/clone/EVNAC1wjQUCuPU9hNlnoZQ/py_env-python3/lib/python3.12/site-packages/flake8/checker.py", line 83, in _mp_run
    ).run_checks()
      ^^^^^^^^^^^^
  File "/pc/clone/EVNAC1wjQUCuPU9hNlnoZQ/py_env-python3/lib/python3.12/site-packages/flake8/checker.py", line 526, in run_checks
    self.run_ast_checks()
  File "/pc/clone/EVNAC1wjQUCuPU9hNlnoZQ/py_env-python3/lib/python3.12/site-packages/flake8/checker.py", line 428, in run_ast_checks
    for line_number, offset, text, _ in runner:
  File "/pc/clone/EVNAC1wjQUCuPU9hNlnoZQ/py_env-python3/lib/python3.12/site-packages/flake8_commas/_base.py", line 333, in run
    for error in get_comma_errors(tokens):
  File "/pc/clone/EVNAC1wjQUCuPU9hNlnoZQ/py_env-python3/lib/python3.12/site-packages/flake8_commas/_base.py", line 306, in get_comma_errors
    (token.type == COLON and stack[-1].comma == LAMBDA_EXPR)
                             ~~~~~^^^^
IndexError: list index out of range
"""

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

Traceback (most recent call last):
  File "/pc/clone/EVNAC1wjQUCuPU9hNlnoZQ/py_env-python3/bin/flake8", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/pc/clone/EVNAC1wjQUCuPU9hNlnoZQ/py_env-python3/lib/python3.12/site-packages/flake8/main/cli.py", line 23, in main
    app.run(argv)
  File "/pc/clone/EVNAC1wjQUCuPU9hNlnoZQ/py_env-python3/lib/python3.12/site-packages/flake8/main/application.py", line 198, in run
    self._run(argv)
  File "/pc/clone/EVNAC1wjQUCuPU9hNlnoZQ/py_env-python3/lib/python3.12/site-packages/flake8/main/application.py", line 187, in _run
    self.run_checks()
  File "/pc/clone/EVNAC1wjQUCuPU9hNlnoZQ/py_env-python3/lib/python3.12/site-packages/flake8/main/application.py", line 103, in run_checks
    self.file_checker_manager.run()
  File "/pc/clone/EVNAC1wjQUCuPU9hNlnoZQ/py_env-python3/lib/python3.12/site-packages/flake8/checker.py", line 236, in run
    self.run_parallel()
  File "/pc/clone/EVNAC1wjQUCuPU9hNlnoZQ/py_env-python3/lib/python3.12/site-packages/flake8/checker.py", line 205, in run_parallel
    self.results = list(pool.imap_unordered(_mp_run, self.filenames))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/multiprocessing/pool.py", line 873, in next
    raise value
IndexError: list index out of range

(https://results.pre-commit.ci/run/github/16620627/1713926290.3FtxdzwlRJKVVhqJTxjy7Q)

So this hinted me to go check that plugin's upstream only to find out that it was archived on Oct 14, 2021, with the "No Maintenance Intended" badge and a recommendation to use a formatter: https://github.com/PyCQA/flake8-commas#flake8-extension-to-enforce-better-comma-placement.

I use the suggested pre-commit fixer which already ensures that I have commas in all the right places so the plugin is redundant. However, it does not seem like there is a way to tell flake8 to skip loading it and WPS pulls it in unconditionally which results in a stalemate 🤷‍♂️

Hence the $sbj.

How it should be

It shouldn't crash the entire flake8 run and be disablable.

Flake8 version and plugins

It's a bump from flake8 v4.0.1 to v7.0.0 combined with bumping WPS.
See cherrypy/cheroot@6f1e5b5#diff-63a9c44a44acf85fea213a857769990937107cf072831e1a26808cfde9d096b9R146-R159.

pip information

N/A, it's only reproducible @ pre-commit.ci so far.

OS information

https://results.pre-commit.ci/run/github/16620627/1713926290.3FtxdzwlRJKVVhqJTxjy7Q says it's image ghcr.io/pre-commit-ci/runner-image:2024-04-23-b71d47a => 5754bdbf0070e1758fa1e47f7b043cd04c7f8bda1d93703ff17e704ffb89a09d and python@python3 in it.

@sobolevn
Copy link
Member

Yes, I plan to switch to ruff for this kind of checks soon! 👍

@webknjaz
Copy link
Contributor Author

Apparently, there's a fork https://pypi.org/project/flake8-commas-x/ that supports Python 3.12. And the fork's author was given maintenance privileges on the original thing last month: PyCQA/meta#59. So maybe it'll get resurrected at some point.

Meanwhile, the dependency could be made conditional depending on the Python version and that should fix the incompatibility short-term.

webknjaz added a commit to webknjaz/cheroot that referenced this issue Apr 24, 2024
This is needed since it explodes on Python 3.12 due to [[1]].

[1]: wemake-services/wemake-python-styleguide#2933
webknjaz added a commit to webknjaz/cheroot that referenced this issue Apr 24, 2024
Flake8 runtime is now pinned to Python 3.11 in pre-commit since it explodes
on Python 3.12 due to [[1]] currently.

[1]: wemake-services/wemake-python-styleguide#2933
webknjaz added a commit to webknjaz/cheroot that referenced this issue Apr 24, 2024
Flake8 runtime is now pinned to Python 3.11 in pre-commit since it explodes
on Python 3.12 due to [[1]] currently.

[1]: wemake-services/wemake-python-styleguide#2933
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants