PyCQA / flake8

flake8 is a python tool that glues together pycodestyle, pyflakes, mccabe, and third-party plugins to check the style and quality of some python code.

Home Page:https://flake8.pycqa.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Whitespace issues with Python 3.12

jessemyers-lettuce opened this issue · comments

how did you install flake8?

% python3 -m venv .venv
% source .venv/bin/activate
(.venv) % pip install flake8==6.1.0 flake8-pyproject==1.2.3

unmodified output of flake8 --bug-report

{
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.12.0",
    "system": "Darwin"
  },
  "plugins": [
    {
      "plugin": "Flake8-pyproject",
      "version": "1.2.3"
    },
    {
      "plugin": "mccabe",
      "version": "0.7.0"
    },
    {
      "plugin": "pycodestyle",
      "version": "2.11.0"
    },
    {
      "plugin": "pyflakes",
      "version": "3.1.0"
    }
  ],
  "version": "6.1.0"
}

describe the problem

I upgrade from Python 3.11 to 3.12 (just released) and see a large number of E201 and E202 errors that were not present previously. The code in question is mostly via f-strings a la:

"Authorization": f"Bearer { access_token }",

The version of flake8 is the same but apparently I get different results. The code in question is the result of a generation process that gets run through black, so it's non-trivial to change the code format. I'd love to some idea why the Python version impacts the flake8 behavior.

It's entirely possible this is due to the flake8-pyproject plugin.

please read the issue template and prompt. this is not the correct place. also
black does not format in f string placeholders so you have unformatted code there

also those error codes are correct so don't report them to the correct place either