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

Clarify how to configure pycodestyle when using pyproject.toml #1193

Closed
RogerMarsh opened this issue Aug 17, 2023 · 1 comment
Closed

Clarify how to configure pycodestyle when using pyproject.toml #1193

RogerMarsh opened this issue Aug 17, 2023 · 1 comment

Comments

@RogerMarsh
Copy link

While converting project configurations from setup.cfg to pyproject.toml a [pycodestyle] section was encountered.

After seeing issues 1180 and 813 I thought pycodestyle might have to be dropped from the code evaluation repertoire until I remembered that an 'sdist' stage in 'python -m build ...' wrote a setup.cfg file.

(read hash, the 'this line is a comment marker', for '!'. I did not know 'hash' meant 'line of bold text' in this editor.)

So I cut down the setup.cfg file to

! pycodestyle does not support toml in the sense that a [tool.pycodestyle]
! section in a pyproject.toml file is ignored.
! However 'python -m build ...' an sdist writes a setup.cfg file, or if one
! already exists rewrites it ignoring comments and appends some stuff.
! Hence the non-comment content of this setup.cfg survives to provide the
! [pycodestyle] section.

[pycodestyle]
! E203 to fit black formatting and pylint.
! W503 is only default ignore which occurs at 2023-07-14, and style is what
! black formatting does if needed. My preference is break after operator
! but easier to let black do what it wants.
! E722 is given for 'bare except' even if re-raised but pylint reports
! 'bare-except' only when the exception is not re-raised.
! E402 not added to 'ignore' list because it was possible to get rid of
! the reports without a corresponding 'wrong-import-position' from pylint
! by moving all unconditional imports (two at 2023-07-18) to before the
! conditional imports.
ignore=E203,W503,E722

and got a clean pycodestyle report from the before, and the after, conversion projects; and was able to get the pycodestyle reports by suppressing the ignore.

I did not look at pycodestyle documentation to see if something like this was mentioned because I assumed the answers to 1180 and 813 would have said 'read the documentation' if such was said.

Should the documentation make this clear?

@asottile
Copy link
Member

it is not supported. there are many config files that are not supported so it does not make sense to enumerate them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants