4 Summary: Python style guide checker
5 Home-page: https://pycodestyle.pycqa.org/
6 Author: Johann C. Rocholl
7 Author-email: johann@rocholl.net
9 Maintainer-email: IanLee1521@gmail.com
11 Project-URL: Changes, https://pycodestyle.pycqa.org/en/latest/developer.html#changes
12 Keywords: pycodestyle,pep8,PEP 8,PEP-8,PEP8
13 Classifier: Development Status :: 5 - Production/Stable
14 Classifier: Environment :: Console
15 Classifier: Intended Audience :: Developers
16 Classifier: License :: OSI Approved :: MIT License
17 Classifier: Operating System :: OS Independent
18 Classifier: Programming Language :: Python
19 Classifier: Programming Language :: Python :: 3
20 Classifier: Programming Language :: Python :: 3 :: Only
21 Classifier: Programming Language :: Python :: Implementation :: CPython
22 Classifier: Programming Language :: Python :: Implementation :: PyPy
23 Classifier: Topic :: Software Development :: Libraries :: Python Modules
24 Requires-Python: >=3.8
25 Description-Content-Type: text/x-rst
28 pycodestyle (formerly called pep8) - Python style guide checker
29 ===============================================================
31 .. image:: https://github.com/PyCQA/pycodestyle/actions/workflows/main.yml/badge.svg
32 :target: https://github.com/PyCQA/pycodestyle/actions/workflows/main.yml
35 .. image:: https://readthedocs.org/projects/pycodestyle/badge/?version=latest
36 :target: https://pycodestyle.pycqa.org
37 :alt: Documentation Status
39 .. image:: https://img.shields.io/pypi/wheel/pycodestyle.svg
40 :target: https://pypi.org/project/pycodestyle/
43 .. image:: https://badges.gitter.im/PyCQA/pycodestyle.svg
44 :alt: Join the chat at https://gitter.im/PyCQA/pycodestyle
45 :target: https://gitter.im/PyCQA/pycodestyle?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
47 pycodestyle is a tool to check your Python code against some of the style
48 conventions in `PEP 8`_.
50 .. _PEP 8: http://www.python.org/dev/peps/pep-0008/
54 This package used to be called ``pep8`` but was renamed to ``pycodestyle``
55 to reduce confusion. Further discussion can be found `in the issue where
57 change <https://github.com/PyCQA/pycodestyle/issues/466>`_, or in the
58 lightning talk at PyCon 2016 by @IanLee1521:
59 `slides <https://speakerdeck.com/ianlee1521/pep8-vs-pep-8>`_
60 `video <https://youtu.be/PulzIT8KYLk?t=36m>`_.
65 * Plugin architecture: Adding new checks is easy.
67 * Parseable output: Jump to error location in your editor.
69 * Small: Just one Python file, requires only stdlib. You can use just
70 the ``pycodestyle.py`` file for this purpose.
72 * Comes with a comprehensive test suite.
77 You can install, upgrade, and uninstall ``pycodestyle.py`` with these commands::
79 $ pip install pycodestyle
80 $ pip install --upgrade pycodestyle
81 $ pip uninstall pycodestyle
83 There's also a package for Debian/Ubuntu, but it's not always the
86 Example usage and output
87 ------------------------
91 $ pycodestyle --first optparse.py
92 optparse.py:69:11: E401 multiple imports on one line
93 optparse.py:77:1: E302 expected 2 blank lines, found 1
94 optparse.py:88:5: E301 expected 1 blank line, found 0
95 optparse.py:347:31: E211 whitespace before '('
96 optparse.py:357:17: E201 whitespace after '{'
97 optparse.py:472:29: E221 multiple spaces before operator
99 You can also make ``pycodestyle.py`` show the source code for each error, and
100 even the relevant text from PEP 8::
102 $ pycodestyle --show-source --show-pep8 testing/data/E40.py
103 testing/data/E40.py:2:10: E401 multiple imports on one line
106 Imports should usually be on separate lines.
108 Okay: import os\nimport sys
112 Or you can display how often each error was found::
114 $ pycodestyle --statistics -qq Python-2.5/Lib
115 232 E201 whitespace after '['
116 599 E202 whitespace before ')'
117 631 E203 whitespace before ','
118 842 E211 whitespace before '('
119 2531 E221 multiple spaces before operator
120 4473 E301 expected 1 blank line, found 0
121 4006 E302 expected 2 blank lines, found 1
122 165 E303 too many blank lines (4)
123 325 E401 multiple imports on one line
124 3615 E501 line too long (82 characters)
129 * `Read the documentation <https://pycodestyle.pycqa.org/>`_
131 * `Fork me on GitHub <http://github.com/PyCQA/pycodestyle>`_