Skip to content

Commit f1962f5

Browse files
committed
Adds support for pyproject.toml
1 parent 0dde8ea commit f1962f5

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

docs/intro.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,8 @@ Example::
200200
max-line-length = 160
201201
statistics = True
202202

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

pycodestyle.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060
from fnmatch import fnmatch
6161
from functools import lru_cache
6262
from optparse import OptionParser
63+
if sys.version_info >= (3, 11):
64+
import tomllib
6365

6466
# this is a performance hack. see https://bugs.python.org/issue43014
6567
if (
@@ -83,7 +85,11 @@
8385
except ImportError:
8486
USER_CONFIG = None
8587

86-
PROJECT_CONFIG = ('setup.cfg', 'tox.ini')
88+
if sys.version_info >= (3, 11):
89+
PROJECT_CONFIG = ('setup.cfg', 'tox.ini', 'pyproject.toml')
90+
else:
91+
PROJECT_CONFIG = ('setup.cfg', 'tox.ini')
92+
8793
MAX_LINE_LENGTH = 79
8894
# Number of blank lines between various code parts.
8995
BLANK_LINES_CONFIG = {

0 commit comments

Comments
 (0)