Ask Your Question

pep8 reformatter configuration?

asked 2022-01-07 06:51:32 -0600

Chris Curvey's avatar

updated 2022-01-12 09:40:38 -0600

I seem to recall that Wing delegates reformatting to an outside executable (pep8, black, yapf, etc) , and that there's a configuration panel for the reformatters, but I can't find it. Can anyone point me in the right direction?


TL;DR - can we change the autopep8formatter to respect the new binary operator + line break recommendations:

Long Version:

My organization requires code to pass a pycodestyle check before being accepted. But Wing sometimes seems to be reformatting some bits of code like:

    if (
        val is None
        or not val.isdigit()
        or int(val) <= 0


    if (
        val is None or
        not val.isdigit() or
        int(val) <= 0

And then pycodestyle complains about

./src/dashboard/ W504 line break after binary operator

The "sometimes" part is interesting. After the reformatting, pycodestyle complains about two blocks of code. If I fix the first block, save, and check, the first block is not reformatted, and then pycodestyle only complains about the second block. But when I fix the second block, the first block is reformatted, and pycodestyle complains again. If I edit BOTH blocks of code and then hit save, neither one is reformatted

Now that I look into it, the docs say that

Wing uses its own copy of autopep8 for PEP 8 style formatting

And if I dig into the docs for autopep8, it apparently depends on pycodestyle itself!

edit retag flag offensive close merge delete


This may be due to a version mismatch between the pycodestyle you have and the one that ships with Wing (2.5.0). Or just a bug in that or the autopep8 that we include (1.5.2). I'm going to upgrade both the copies of autopep8 and pycodestyle that Wing ships with, from version 1.5.2 to 1.6.0 for autopep8 and version 2.5.0 to 2.8.0 for pycodestyle (both the latest).

Longer term, we may want to add a way to get Wing to use your installed autopep8, as a way to avoid problems like this. Of course the installed autopep8 in your Python may also not match the version being used in precommit hooks.

I should note that I tried both with the above versions and got the same result in both cases it's but different than what you seemed ...(more)

Wingware Support's avatar Wingware Support  ( 2022-01-12 14:21:54 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2022-01-07 07:58:15 -0600

This is controlled from the Options tab in Project Properties or the Editor > Auto-Reformatting preferences page. The docs are at

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2022-01-07 06:51:32 -0600

Seen: 175 times

Last updated: Jan 24