First time here? Check out the FAQ!

Revision history  [back]

pep8 reformatter configuration?

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?

UPDATE:

TL;DR - can we change the autopep8 formatter to respect the new binary operator + line break recommendations: https://www.python.org/dev/peps/pep-0008/#should-a-line-break-before-or-after-a-binary-operator

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
    ):

to

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

And then pycodestyle complains about

./src/dashboard/utils.py:39:25: 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!

pep8 reformatter configuration?

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?

UPDATE:

TL;DR - can we change the autopep8 formatter to respect the new binary operator + line break recommendations: https://www.python.org/dev/peps/pep-0008/#should-a-line-break-before-or-after-a-binary-operator

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
    ):

to ```

to

```

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

```

And then pycodestyle complains about

./src/dashboard/utils.py:39:25: 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!

pep8 reformatter configuration?

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?

UPDATE:

TL;DR - can we change the autopep8 formatter to respect the new binary operator + line break recommendations: https://www.python.org/dev/peps/pep-0008/#should-a-line-break-before-or-after-a-binary-operator

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
    ):

```

to

```

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

```

And then pycodestyle complains about

./src/dashboard/utils.py:39:25: 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!

pep8 reformatter configuration?

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?