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

Adds support for pyproject.toml for python 3.11+ projects #1223

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ Example::
max-line-length = 160
statistics = True

At the project level, a ``setup.cfg`` file or a ``tox.ini`` file is read if
At the project level, a ``setup.cfg`` file or a ``tox.ini``
(or a ``pyproject.toml`` if running python 3.11+) file is read if
present. If none of these files have a ``[pycodestyle]`` section, no project
specific configuration is loaded.

Expand Down
7 changes: 5 additions & 2 deletions pycodestyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@
except ImportError:
USER_CONFIG = None

PROJECT_CONFIG = ('setup.cfg', 'tox.ini')
if sys.version_info >= (3, 11):
PROJECT_CONFIG = ('setup.cfg', 'tox.ini', 'pyproject.toml')
else:
PROJECT_CONFIG = ('setup.cfg', 'tox.ini')

MAX_LINE_LENGTH = 79
# Number of blank lines between various code parts.
BLANK_LINES_CONFIG = {
Expand Down Expand Up @@ -2494,7 +2498,6 @@ def read_config(options, args, arglist, parser):
ConfigParser.
"""
config = configparser.RawConfigParser()

cli_conf = options.config

local_dir = os.curdir
Expand Down