<!DOCTYPE html> <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Developer’s notes — pep8 1.7.1 documentation</title> <link rel="stylesheet" href="_static/css/theme.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <link rel="index" title="Index" href="genindex.html" /> <link rel="search" title="Search" href="search.html" /> <link rel="prev" title="pep8 API" href="api.html" /> <script src="_static/js/modernizr.min.js"></script> </head> <body class="wy-body-for-nav"> <div class="wy-grid-for-nav"> <nav data-toggle="wy-nav-shift" class="wy-nav-side"> <div class="wy-side-scroll"> <div class="wy-side-nav-search"> <a href="index.html" class="icon icon-home"> pep8 </a> <div class="version"> 1.7 </div> <div role="search"> <form id="rtd-search-form" class="wy-form" action="search.html" method="get"> <input type="text" name="q" placeholder="Search docs" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> </div> <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> <ul class="current"> <li class="toctree-l1"><a class="reference internal" href="intro.html">Introduction</a></li> <li class="toctree-l1"><a class="reference internal" href="advanced.html">Advanced usage</a></li> <li class="toctree-l1"><a class="reference internal" href="api.html">API</a></li> <li class="toctree-l1 current"><a class="current reference internal" href="#">Developer’s notes</a><ul> <li class="toctree-l2"><a class="reference internal" href="#source-code">Source code</a></li> <li class="toctree-l2"><a class="reference internal" href="#direction">Direction</a></li> <li class="toctree-l2"><a class="reference internal" href="#contribute">Contribute</a></li> <li class="toctree-l2"><a class="reference internal" href="#changes">Changes</a><ul> <li class="toctree-l3"><a class="reference internal" href="#id2">1.7.1 (2017-10-22)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id3">1.7.0 (2016-01-12)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id4">1.6.2 (2015-02-15)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id5">1.6.1 (2015-02-08)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id6">1.6.0 (2015-02-06)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id7">1.5.7 (2014-05-29)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id8">1.5.6 (2014-04-14)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id9">1.5.5 (2014-04-10)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id10">1.5.4 (2014-04-07)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id11">1.5.3 (2014-04-04)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id12">1.5.2 (2014-04-04)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id13">1.5.1 (2014-03-27)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id14">1.5 (2014-03-26)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id15">1.4.6 (2013-07-02)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id16">1.4.5 (2013-03-06)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id17">1.4.4 (2013-02-24)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id18">1.4.3 (2013-02-22)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id19">1.4.2 (2013-02-10)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id20">1.4.1 (2013-01-18)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id21">1.4 (2012-12-22)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id22">1.3.4 (2012-12-18)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id23">1.3.3 (2012-06-27)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id24">1.3.2 (2012-06-26)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id25">1.3.1 (2012-06-18)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id26">1.3 (2012-06-15)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id27">1.2 (2012-06-01)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id28">1.1 (2012-05-24)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id29">1.0.1 (2012-04-06)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id30">1.0 (2012-04-04)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id31">0.7.0 (2012-03-26)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id32">0.6.1 (2010-10-03)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id33">0.6.0 (2010-09-19)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id34">0.5.0 (2010-02-17)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id38">0.4.2 (2009-10-22)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id39">0.4 (2009-10-20)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id45">0.3.1 (2009-09-14)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id46">0.2 (2007-10-16)</a></li> <li class="toctree-l3"><a class="reference internal" href="#id47">0.1 (2006-10-01)</a></li> </ul> </li> </ul> </li> </ul> </div> </div> </nav> <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> <nav class="wy-nav-top" aria-label="top navigation"> <i data-toggle="wy-nav-top" class="fa fa-bars"></i> <a href="index.html">pep8</a> </nav> <div class="wy-nav-content"> <div class="rst-content"> <div role="navigation" aria-label="breadcrumbs navigation"> <ul class="wy-breadcrumbs"> <li><a href="index.html">Docs</a> »</li> <li>Developer’s notes</li> <li class="wy-breadcrumbs-aside"> <a href="_sources/developer.rst.txt" rel="nofollow"> View page source</a> </li> </ul> <hr/> </div> <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> <div itemprop="articleBody"> <div class="section" id="developer-s-notes"> <h1>Developer’s notes<a class="headerlink" href="#developer-s-notes" title="Permalink to this headline">¶</a></h1> <div class="section" id="source-code"> <h2>Source code<a class="headerlink" href="#source-code" title="Permalink to this headline">¶</a></h2> <p>The source code is currently <a class="reference external" href="https://github.com/pycqa/pep8">available on GitHub</a> under the terms and conditions of the <a class="reference internal" href="index.html#license"><span class="std std-ref">Expat license</span></a>. Fork away!</p> <ul class="simple"> <li><a class="reference external" href="https://github.com/pycqa/pep8">Source code</a> and <a class="reference external" href="https://github.com/pycqa/pep8/issues">issue tracker</a> on GitHub.</li> <li><a class="reference external" href="http://travis-ci.org/pycqa/pep8">Continuous tests</a> against Python 2.6 through 3.4 and PyPy, on <a class="reference external" href="http://about.travis-ci.org/">Travis-CI platform</a>.</li> </ul> </div> <div class="section" id="direction"> <h2>Direction<a class="headerlink" href="#direction" title="Permalink to this headline">¶</a></h2> <p>Some high-level aims and directions to bear in mind for contributions:</p> <ul class="simple"> <li><code class="docutils literal notranslate"><span class="pre">pep8</span></code> is intended to be as fast as possible. Using the <code class="docutils literal notranslate"><span class="pre">ast</span></code> module defeats that purpose. The <a class="reference external" href="https://github.com/flintwork/pep8-naming">pep8-naming</a> plugin exists for this sort of functionality.</li> <li>If you want to provide extensibility / plugins, please see <a class="reference external" href="https://gitlab.com/pycqa/flake8">flake8</a> - <code class="docutils literal notranslate"><span class="pre">pep8</span></code> doesn’t want or need a plugin architecture.</li> <li>Python 2.6 support is still deemed important.</li> <li><code class="docutils literal notranslate"><span class="pre">pep8</span></code> aims to have no external dependencies.</li> </ul> </div> <div class="section" id="contribute"> <h2>Contribute<a class="headerlink" href="#contribute" title="Permalink to this headline">¶</a></h2> <p>You can add checks to this program by writing plugins. Each plugin is a simple function that is called for each line of source code, either physical or logical.</p> <p>Physical line:</p> <ul class="simple"> <li>Raw line of text from the input file.</li> </ul> <p>Logical line:</p> <ul class="simple"> <li>Multi-line statements converted to a single line.</li> <li>Stripped left and right.</li> <li>Contents of strings replaced with <code class="docutils literal notranslate"><span class="pre">"xxx"</span></code> of same length.</li> <li>Comments removed.</li> </ul> <p>The check function requests physical or logical lines by the name of the first argument:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">maximum_line_length</span><span class="p">(</span><span class="n">physical_line</span><span class="p">)</span> <span class="k">def</span> <span class="nf">extraneous_whitespace</span><span class="p">(</span><span class="n">logical_line</span><span class="p">)</span> <span class="k">def</span> <span class="nf">blank_lines</span><span class="p">(</span><span class="n">logical_line</span><span class="p">,</span> <span class="n">blank_lines</span><span class="p">,</span> <span class="n">indent_level</span><span class="p">,</span> <span class="n">line_number</span><span class="p">)</span> </pre></div> </div> <p>The last example above demonstrates how check plugins can request additional information with extra arguments. All attributes of the <a class="reference internal" href="api.html#pep8.Checker" title="pep8.Checker"><code class="xref py py-class docutils literal notranslate"><span class="pre">Checker</span></code></a> object are available. Some examples:</p> <ul class="simple"> <li><code class="docutils literal notranslate"><span class="pre">lines</span></code>: a list of the raw lines from the input file</li> <li><code class="docutils literal notranslate"><span class="pre">tokens</span></code>: the tokens that contribute to this logical line</li> <li><code class="docutils literal notranslate"><span class="pre">line_number</span></code>: line number in the input file</li> <li><code class="docutils literal notranslate"><span class="pre">total_lines</span></code>: number of lines in the input file</li> <li><code class="docutils literal notranslate"><span class="pre">blank_lines</span></code>: blank lines before this one</li> <li><code class="docutils literal notranslate"><span class="pre">indent_char</span></code>: indentation character in this file (<code class="docutils literal notranslate"><span class="pre">"</span> <span class="pre">"</span></code> or <code class="docutils literal notranslate"><span class="pre">"\t"</span></code>)</li> <li><code class="docutils literal notranslate"><span class="pre">indent_level</span></code>: indentation (with tabs expanded to multiples of 8)</li> <li><code class="docutils literal notranslate"><span class="pre">previous_indent_level</span></code>: indentation on previous line</li> <li><code class="docutils literal notranslate"><span class="pre">previous_logical</span></code>: previous logical line</li> </ul> <p>Check plugins can also maintain per-file state. If you need this, declare a parameter named <code class="docutils literal notranslate"><span class="pre">checker_state</span></code>. You will be passed a dict, which will be the same one for all lines in the same file but a different one for different files. Each check plugin gets its own dict, so you don’t need to worry about clobbering the state of other plugins.</p> <p>The docstring of each check function shall be the relevant part of text from <a class="reference external" href="http://www.python.org/dev/peps/pep-0008/">PEP 8</a>. It is printed if the user enables <code class="docutils literal notranslate"><span class="pre">--show-pep8</span></code>. Several docstrings contain examples directly from the <a class="reference external" href="http://www.python.org/dev/peps/pep-0008/">PEP 8</a> document.</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Okay</span><span class="p">:</span> <span class="n">spam</span><span class="p">(</span><span class="n">ham</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="p">{</span><span class="n">eggs</span><span class="p">:</span> <span class="mi">2</span><span class="p">})</span> <span class="n">E201</span><span class="p">:</span> <span class="n">spam</span><span class="p">(</span> <span class="n">ham</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="p">{</span><span class="n">eggs</span><span class="p">:</span> <span class="mi">2</span><span class="p">})</span> </pre></div> </div> <p>These examples are verified automatically when pep8.py is run with the <code class="docutils literal notranslate"><span class="pre">--doctest</span></code> option. You can add examples for your own check functions. The format is simple: <code class="docutils literal notranslate"><span class="pre">"Okay"</span></code> or error/warning code followed by colon and space, the rest of the line is example source code. If you put <code class="docutils literal notranslate"><span class="pre">'r'</span></code> before the docstring, you can use <code class="docutils literal notranslate"><span class="pre">\n</span></code> for newline and <code class="docutils literal notranslate"><span class="pre">\t</span></code> for tab.</p> <p>Then be sure to pass the tests:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ python pep8.py --testsuite testsuite $ python pep8.py --doctest $ python pep8.py --verbose pep8.py </pre></div> </div> </div> <div class="section" id="changes"> <h2>Changes<a class="headerlink" href="#changes" title="Permalink to this headline">¶</a></h2> <div class="section" id="id2"> <h3>1.7.1 (2017-10-22)<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h3> <p>Changes:</p> <ul class="simple"> <li>Prominently note via warning message that the tool is no longer released as <code class="docutils literal notranslate"><span class="pre">pep8</span></code> and will only be fixed in the <code class="docutils literal notranslate"><span class="pre">pycodestyle</span></code> package</li> </ul> </div> <div class="section" id="id3"> <h3>1.7.0 (2016-01-12)<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h3> <p>Announcements:</p> <ul class="simple"> <li>Repository moved to PyCQA Organization on GitHub: <a class="reference external" href="https://github.com/pycqa/pep8">https://github.com/pycqa/pep8</a></li> </ul> <p>Changes:</p> <ul class="simple"> <li>Reverted the fix in #368, “options passed on command line are only ones accepted” feature. This has many unintended consequences in pep8 and flake8 and needs to be reworked when I have more time.</li> <li>Added support for Python 3.5. (Issue #420 & #459)</li> <li>Added support for multi-line config_file option parsing. (Issue #429)</li> <li>Improved parameter parsing. (Issues #420 & #456)</li> </ul> <p>Bugs:</p> <ul class="simple"> <li>Fixed BytesWarning on Python 3. (Issue #459)</li> </ul> </div> <div class="section" id="id4"> <h3>1.6.2 (2015-02-15)<a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h3> <p>Changes:</p> <ul class="simple"> <li>Added check for breaking around a binary operator. (Issue #197, Pull #305)</li> </ul> <p>Bugs:</p> <ul class="simple"> <li>Restored config_file parameter in process_options(). (Issue #380)</li> </ul> </div> <div class="section" id="id5"> <h3>1.6.1 (2015-02-08)<a class="headerlink" href="#id5" title="Permalink to this headline">¶</a></h3> <p>Changes:</p> <ul class="simple"> <li>Assign variables before referenced. (Issue #287)</li> </ul> <p>Bugs:</p> <ul class="simple"> <li>Exception thrown due to unassigned <code class="docutils literal notranslate"><span class="pre">local_dir</span></code> variable. (Issue #377)</li> </ul> </div> <div class="section" id="id6"> <h3>1.6.0 (2015-02-06)<a class="headerlink" href="#id6" title="Permalink to this headline">¶</a></h3> <p>News:</p> <ul class="simple"> <li>Ian Lee <<a class="reference external" href="mailto:ianlee1521%40gmail.com">ianlee1521<span>@</span>gmail<span>.</span>com</a>> joined the project as a maintainer.</li> </ul> <p>Changes:</p> <ul class="simple"> <li>Report E731 for lambda assignment. (Issue #277)</li> <li>Report E704 for one-liner def instead of E701. Do not report this error in the default configuration. (Issue #277)</li> <li>Replace codes E111, E112 and E113 with codes E114, E115 and E116 for bad indentation of comments. (Issue #274)</li> <li>Report E266 instead of E265 when the block comment starts with multiple <code class="docutils literal notranslate"><span class="pre">#</span></code>. (Issue #270)</li> <li>Report E402 for import statements not at the top of the file. (Issue #264)</li> <li>Do not enforce whitespaces around <code class="docutils literal notranslate"><span class="pre">**</span></code> operator. (Issue #292)</li> <li>Strip whitespace from around paths during normalization. (Issue #339 / #343)</li> <li>Update <code class="docutils literal notranslate"><span class="pre">--format</span></code> documentation. (Issue #198 / Pull Request #310)</li> <li>Add <code class="docutils literal notranslate"><span class="pre">.tox/</span></code> to default excludes. (Issue #335)</li> <li>Do not report E121 or E126 in the default configuration. (Issues #256 / #316)</li> <li>Allow spaces around the equals sign in an annotated function. (Issue #357)</li> <li>Allow trailing backslash if in an inline comment. (Issue #374)</li> <li>If <code class="docutils literal notranslate"><span class="pre">--config</span></code> is used, only that configuration is processed. Otherwise, merge the user and local configurations are merged. (Issue #368 / #369)</li> </ul> <p>Bug fixes:</p> <ul class="simple"> <li>Don’t crash if Checker.build_tokens_line() returns None. (Issue #306)</li> <li>Don’t crash if os.path.expanduser() throws an ImportError. (Issue #297)</li> <li>Missing space around keyword parameter equal not always reported, E251. (Issue #323)</li> <li>Fix false positive E711/E712/E713. (Issues #330 and #336)</li> <li>Do not skip physical checks if the newline is escaped. (Issue #319)</li> <li>Flush sys.stdout to avoid race conditions with printing. See flake8 bug: <a class="reference external" href="https://gitlab.com/pycqa/flake8/issues/17">https://gitlab.com/pycqa/flake8/issues/17</a> for more details. (Issue #363)</li> </ul> </div> <div class="section" id="id7"> <h3>1.5.7 (2014-05-29)<a class="headerlink" href="#id7" title="Permalink to this headline">¶</a></h3> <p>Bug fixes:</p> <ul class="simple"> <li>Skip the traceback on “Broken pipe” signal. (Issue #275)</li> <li>Do not exit when an option in <code class="docutils literal notranslate"><span class="pre">setup.cfg</span></code> or <code class="docutils literal notranslate"><span class="pre">tox.ini</span></code> is not recognized.</li> <li>Check the last line even if it does not end with a newline. (Issue #286)</li> <li>Always open files in universal newlines mode in Python 2. (Issue #288)</li> </ul> </div> <div class="section" id="id8"> <h3>1.5.6 (2014-04-14)<a class="headerlink" href="#id8" title="Permalink to this headline">¶</a></h3> <p>Bug fixes:</p> <ul class="simple"> <li>Check the last line even if it has no end-of-line. (Issue #273)</li> </ul> </div> <div class="section" id="id9"> <h3>1.5.5 (2014-04-10)<a class="headerlink" href="#id9" title="Permalink to this headline">¶</a></h3> <p>Bug fixes:</p> <ul class="simple"> <li>Fix regression with E22 checks and inline comments. (Issue #271)</li> </ul> </div> <div class="section" id="id10"> <h3>1.5.4 (2014-04-07)<a class="headerlink" href="#id10" title="Permalink to this headline">¶</a></h3> <p>Bug fixes:</p> <ul class="simple"> <li>Fix negative offset with E303 before a multi-line docstring. (Issue #269)</li> </ul> </div> <div class="section" id="id11"> <h3>1.5.3 (2014-04-04)<a class="headerlink" href="#id11" title="Permalink to this headline">¶</a></h3> <p>Bug fixes:</p> <ul class="simple"> <li>Fix wrong offset computation when error is on the last char of a physical line. (Issue #268)</li> </ul> </div> <div class="section" id="id12"> <h3>1.5.2 (2014-04-04)<a class="headerlink" href="#id12" title="Permalink to this headline">¶</a></h3> <p>Changes:</p> <ul class="simple"> <li>Distribute a universal wheel file.</li> </ul> <p>Bug fixes:</p> <ul class="simple"> <li>Report correct line number for E303 with comments. (Issue #60)</li> <li>Do not allow newline after parameter equal. (Issue #252)</li> <li>Fix line number reported for multi-line strings. (Issue #220)</li> <li>Fix false positive E121/E126 with multi-line strings. (Issue #265)</li> <li>Fix E501 not detected in comments with Python 2.5.</li> <li>Fix caret position with <code class="docutils literal notranslate"><span class="pre">--show-source</span></code> when line contains tabs.</li> </ul> </div> <div class="section" id="id13"> <h3>1.5.1 (2014-03-27)<a class="headerlink" href="#id13" title="Permalink to this headline">¶</a></h3> <p>Bug fixes:</p> <ul class="simple"> <li>Fix a crash with E125 on multi-line strings. (Issue #263)</li> </ul> </div> <div class="section" id="id14"> <h3>1.5 (2014-03-26)<a class="headerlink" href="#id14" title="Permalink to this headline">¶</a></h3> <p>Changes:</p> <ul class="simple"> <li>Report E129 instead of E125 for visually indented line with same indent as next logical line. (Issue #126)</li> <li>Report E265 for space before block comment. (Issue #190)</li> <li>Report E713 and E714 when operators <code class="docutils literal notranslate"><span class="pre">not</span> <span class="pre">in</span></code> and <code class="docutils literal notranslate"><span class="pre">is</span> <span class="pre">not</span></code> are recommended. (Issue #236)</li> <li>Allow long lines in multiline strings and comments if they cannot be wrapped. (Issue #224).</li> <li>Optionally disable physical line checks inside multiline strings, using <code class="docutils literal notranslate"><span class="pre">#</span> <span class="pre">noqa</span></code>. (Issue #242)</li> <li>Change text for E121 to report “continuation line under-indented for hanging indent” instead of indentation not being a multiple of 4.</li> <li>Report E131 instead of E121 / E126 if the hanging indent is not consistent within the same continuation block. It helps when error E121 or E126 is in the <code class="docutils literal notranslate"><span class="pre">ignore</span></code> list.</li> <li>Report E126 instead of E121 when the continuation line is hanging with extra indentation, even if indentation is not a multiple of 4.</li> </ul> <p>Bug fixes:</p> <ul class="simple"> <li>Allow the checkers to report errors on empty files. (Issue #240)</li> <li>Fix ignoring too many checks when <code class="docutils literal notranslate"><span class="pre">--select</span></code> is used with codes declared in a flake8 extension. (Issue #216)</li> <li>Fix regression with multiple brackets. (Issue #214)</li> <li>Fix <code class="docutils literal notranslate"><span class="pre">StyleGuide</span></code> to parse the local configuration if the keyword argument <code class="docutils literal notranslate"><span class="pre">paths</span></code> is specified. (Issue #246)</li> <li>Fix a false positive E124 for hanging indent. (Issue #254)</li> <li>Fix a false positive E126 with embedded colon. (Issue #144)</li> <li>Fix a false positive E126 when indenting with tabs. (Issue #204)</li> <li>Fix behaviour when <code class="docutils literal notranslate"><span class="pre">exclude</span></code> is in the configuration file and the current directory is not the project directory. (Issue #247)</li> <li>The logical checks can return <code class="docutils literal notranslate"><span class="pre">None</span></code> instead of an empty iterator. (Issue #250)</li> <li>Do not report multiple E101 if only the first indentation starts with a tab. (Issue #237)</li> <li>Fix a rare false positive W602. (Issue #34)</li> </ul> </div> <div class="section" id="id15"> <h3>1.4.6 (2013-07-02)<a class="headerlink" href="#id15" title="Permalink to this headline">¶</a></h3> <p>Changes:</p> <ul class="simple"> <li>Honor <code class="docutils literal notranslate"><span class="pre">#</span> <span class="pre">noqa</span></code> for errors E711 and E712. (Issue #180)</li> <li>When both a <code class="docutils literal notranslate"><span class="pre">tox.ini</span></code> and a <code class="docutils literal notranslate"><span class="pre">setup.cfg</span></code> are present in the project directory, merge their contents. The <code class="docutils literal notranslate"><span class="pre">tox.ini</span></code> file takes precedence (same as before). (Issue #182)</li> <li>Give priority to <code class="docutils literal notranslate"><span class="pre">--select</span></code> over <code class="docutils literal notranslate"><span class="pre">--ignore</span></code>. (Issue #188)</li> <li>Compare full path when excluding a file. (Issue #186)</li> <li>New option <code class="docutils literal notranslate"><span class="pre">--hang-closing</span></code> to switch to the alternative style of closing bracket indentation for hanging indent. Add error E133 for closing bracket which is missing indentation. (Issue #103)</li> <li>Accept both styles of closing bracket indentation for hanging indent. Do not report error E123 in the default configuration. (Issue #103)</li> </ul> <p>Bug fixes:</p> <ul class="simple"> <li>Do not crash when running AST checks and the document contains null bytes. (Issue #184)</li> <li>Correctly report other E12 errors when E123 is ignored. (Issue #103)</li> <li>Fix false positive E261/E262 when the file contains a BOM. (Issue #193)</li> <li>Fix E701, E702 and E703 not detected sometimes. (Issue #196)</li> <li>Fix E122 not detected in some cases. (Issue #201 and #208)</li> <li>Fix false positive E121 with multiple brackets. (Issue #203)</li> </ul> </div> <div class="section" id="id16"> <h3>1.4.5 (2013-03-06)<a class="headerlink" href="#id16" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li>When no path is specified, do not try to read from stdin. The feature was added in 1.4.3, but it is not supported on Windows. Use <code class="docutils literal notranslate"><span class="pre">-</span></code> filename argument to read from stdin. This usage is supported since 1.3.4. (Issue #170)</li> <li>Do not require <code class="docutils literal notranslate"><span class="pre">setuptools</span></code> in setup.py. It works around an issue with <code class="docutils literal notranslate"><span class="pre">pip</span></code> and Python 3. (Issue #172)</li> <li>Add <code class="docutils literal notranslate"><span class="pre">__pycache__</span></code> to the ignore list.</li> <li>Change misleading message for E251. (Issue #171)</li> <li>Do not report false E302 when the source file has a coding cookie or a comment on the first line. (Issue #174)</li> <li>Reorganize the tests and add tests for the API and for the command line usage and options. (Issues #161 and #162)</li> <li>Ignore all checks which are not explicitly selected when <code class="docutils literal notranslate"><span class="pre">select</span></code> is passed to the <code class="docutils literal notranslate"><span class="pre">StyleGuide</span></code> constructor.</li> </ul> </div> <div class="section" id="id17"> <h3>1.4.4 (2013-02-24)<a class="headerlink" href="#id17" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li>Report E227 or E228 instead of E225 for whitespace around bitwise, shift or modulo operators. (Issue #166)</li> <li>Change the message for E226 to make clear that it is about arithmetic operators.</li> <li>Fix a false positive E128 for continuation line indentation with tabs.</li> <li>Fix regression with the <code class="docutils literal notranslate"><span class="pre">--diff</span></code> option. (Issue #169)</li> <li>Fix the <code class="docutils literal notranslate"><span class="pre">TestReport</span></code> class to print the unexpected warnings and errors.</li> </ul> </div> <div class="section" id="id18"> <h3>1.4.3 (2013-02-22)<a class="headerlink" href="#id18" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li>Hide the <code class="docutils literal notranslate"><span class="pre">--doctest</span></code> and <code class="docutils literal notranslate"><span class="pre">--testsuite</span></code> options when installed.</li> <li>Fix crash with AST checkers when the syntax is invalid. (Issue #160)</li> <li>Read from standard input if no path is specified.</li> <li>Initiate a graceful shutdown on <code class="docutils literal notranslate"><span class="pre">Control+C</span></code>.</li> <li>Allow to change the <code class="docutils literal notranslate"><span class="pre">checker_class</span></code> for the <code class="docutils literal notranslate"><span class="pre">StyleGuide</span></code>.</li> </ul> </div> <div class="section" id="id19"> <h3>1.4.2 (2013-02-10)<a class="headerlink" href="#id19" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li>Support AST checkers provided by third-party applications.</li> <li>Register new checkers with <code class="docutils literal notranslate"><span class="pre">register_check(func_or_cls,</span> <span class="pre">codes)</span></code>.</li> <li>Allow to construct a <code class="docutils literal notranslate"><span class="pre">StyleGuide</span></code> with a custom parser.</li> <li>Accept visual indentation without parenthesis after the <code class="docutils literal notranslate"><span class="pre">if</span></code> statement. (Issue #151)</li> <li>Fix UnboundLocalError when using <code class="docutils literal notranslate"><span class="pre">#</span> <span class="pre">noqa</span></code> with continued lines. (Issue #158)</li> <li>Re-order the lines for the <code class="docutils literal notranslate"><span class="pre">StandardReport</span></code>.</li> <li>Expand tabs when checking E12 continuation lines. (Issue #155)</li> <li>Refactor the testing class <code class="docutils literal notranslate"><span class="pre">TestReport</span></code> and the specific test functions into a separate test module.</li> </ul> </div> <div class="section" id="id20"> <h3>1.4.1 (2013-01-18)<a class="headerlink" href="#id20" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li>Allow sphinx.ext.autodoc syntax for comments. (Issue #110)</li> <li>Report E703 instead of E702 for the trailing semicolon. (Issue #117)</li> <li>Honor <code class="docutils literal notranslate"><span class="pre">#</span> <span class="pre">noqa</span></code> in addition to <code class="docutils literal notranslate"><span class="pre">#</span> <span class="pre">nopep8</span></code>. (Issue #149)</li> <li>Expose the <code class="docutils literal notranslate"><span class="pre">OptionParser</span></code> factory for better extensibility.</li> </ul> </div> <div class="section" id="id21"> <h3>1.4 (2012-12-22)<a class="headerlink" href="#id21" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li>Report E226 instead of E225 for optional whitespace around common operators (<code class="docutils literal notranslate"><span class="pre">*</span></code>, <code class="docutils literal notranslate"><span class="pre">**</span></code>, <code class="docutils literal notranslate"><span class="pre">/</span></code>, <code class="docutils literal notranslate"><span class="pre">+</span></code> and <code class="docutils literal notranslate"><span class="pre">-</span></code>). This new error code is ignored in the default configuration because PEP 8 recommends to “use your own judgement”. (Issue #96)</li> <li>Lines with a <code class="docutils literal notranslate"><span class="pre">#</span> <span class="pre">nopep8</span></code> at the end will not issue errors on line length E501 or continuation line indentation E12*. (Issue #27)</li> <li>Fix AssertionError when the source file contains an invalid line ending <code class="docutils literal notranslate"><span class="pre">"\r\r\n"</span></code>. (Issue #119)</li> <li>Read the <code class="docutils literal notranslate"><span class="pre">[pep8]</span></code> section of <code class="docutils literal notranslate"><span class="pre">tox.ini</span></code> or <code class="docutils literal notranslate"><span class="pre">setup.cfg</span></code> if present. (Issue #93 and #141)</li> <li>Add the Sphinx-based documentation, and publish it on <a class="reference external" href="http://pep8.readthedocs.org/">http://pep8.readthedocs.org/</a>. (Issue #105)</li> </ul> </div> <div class="section" id="id22"> <h3>1.3.4 (2012-12-18)<a class="headerlink" href="#id22" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li>Fix false positive E124 and E128 with comments. (Issue #100)</li> <li>Fix error on stdin when running with bpython. (Issue #101)</li> <li>Fix false positive E401. (Issue #104)</li> <li>Report E231 for nested dictionary in list. (Issue #142)</li> <li>Catch E271 at the beginning of the line. (Issue #133)</li> <li>Fix false positive E126 for multi-line comments. (Issue #138)</li> <li>Fix false positive E221 when operator is preceded by a comma. (Issue #135)</li> <li>Fix <code class="docutils literal notranslate"><span class="pre">--diff</span></code> failing on one-line hunk. (Issue #137)</li> <li>Fix the <code class="docutils literal notranslate"><span class="pre">--exclude</span></code> switch for directory paths. (Issue #111)</li> <li>Use <code class="docutils literal notranslate"><span class="pre">-</span></code> filename to read from standard input. (Issue #128)</li> </ul> </div> <div class="section" id="id23"> <h3>1.3.3 (2012-06-27)<a class="headerlink" href="#id23" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li>Fix regression with continuation line checker. (Issue #98)</li> </ul> </div> <div class="section" id="id24"> <h3>1.3.2 (2012-06-26)<a class="headerlink" href="#id24" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li>Revert to the previous behaviour for <code class="docutils literal notranslate"><span class="pre">--show-pep8</span></code>: do not imply <code class="docutils literal notranslate"><span class="pre">--first</span></code>. (Issue #89)</li> <li>Add E902 for IO errors. (Issue #87)</li> <li>Fix false positive for E121, and missed E124. (Issue #92)</li> <li>Set a sensible default path for config file on Windows. (Issue #95)</li> <li>Allow <code class="docutils literal notranslate"><span class="pre">verbose</span></code> in the configuration file. (Issue #91)</li> <li>Show the enforced <code class="docutils literal notranslate"><span class="pre">max-line-length</span></code> in the error message. (Issue #86)</li> </ul> </div> <div class="section" id="id25"> <h3>1.3.1 (2012-06-18)<a class="headerlink" href="#id25" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li>Explain which configuration options are expected. Accept and recommend the options names with hyphen instead of underscore. (Issue #82)</li> <li>Do not read the user configuration when used as a module (except if <code class="docutils literal notranslate"><span class="pre">config_file=True</span></code> is passed to the <code class="docutils literal notranslate"><span class="pre">StyleGuide</span></code> constructor).</li> <li>Fix wrong or missing cases for the E12 series.</li> <li>Fix cases where E122 was missed. (Issue #81)</li> </ul> </div> <div class="section" id="id26"> <h3>1.3 (2012-06-15)<a class="headerlink" href="#id26" title="Permalink to this headline">¶</a></h3> <div class="admonition warning"> <p class="first admonition-title">Warning</p> <p class="last">The internal API is backwards incompatible.</p> </div> <ul class="simple"> <li>Remove global configuration and refactor the library around a <code class="docutils literal notranslate"><span class="pre">StyleGuide</span></code> class; add the ability to configure various reporters. (Issue #35 and #66)</li> <li>Read user configuration from <code class="docutils literal notranslate"><span class="pre">~/.config/pep8</span></code> and local configuration from <code class="docutils literal notranslate"><span class="pre">./.pep8</span></code>. (Issue #22)</li> <li>Fix E502 for backslash embedded in multi-line string. (Issue #68)</li> <li>Fix E225 for Python 3 iterable unpacking (PEP 3132). (Issue #72)</li> <li>Enable the new checkers from the E12 series in the default configuration.</li> <li>Suggest less error-prone alternatives for E712 errors.</li> <li>Rewrite checkers to run faster (E22, E251, E27).</li> <li>Fixed a crash when parsed code is invalid (too many closing brackets).</li> <li>Fix E127 and E128 for continuation line indentation. (Issue #74)</li> <li>New option <code class="docutils literal notranslate"><span class="pre">--format</span></code> to customize the error format. (Issue #23)</li> <li>New option <code class="docutils literal notranslate"><span class="pre">--diff</span></code> to check only modified code. The unified diff is read from STDIN. Example: <code class="docutils literal notranslate"><span class="pre">hg</span> <span class="pre">diff</span> <span class="pre">|</span> <span class="pre">pep8</span> <span class="pre">--diff</span></code> (Issue #39)</li> <li>Correctly report the count of failures and set the exit code to 1 when the <code class="docutils literal notranslate"><span class="pre">--doctest</span></code> or the <code class="docutils literal notranslate"><span class="pre">--testsuite</span></code> fails.</li> <li>Correctly detect the encoding in Python 3. (Issue #69)</li> <li>Drop support for Python 2.3, 2.4 and 3.0. (Issue #78)</li> </ul> </div> <div class="section" id="id27"> <h3>1.2 (2012-06-01)<a class="headerlink" href="#id27" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li>Add E121 through E128 for continuation line indentation. These checks are disabled by default. If you want to force all checks, use switch <code class="docutils literal notranslate"><span class="pre">--select=E,W</span></code>. Patch by Sam Vilain. (Issue #64)</li> <li>Add E721 for direct type comparisons. (Issue #47)</li> <li>Add E711 and E712 for comparisons to singletons. (Issue #46)</li> <li>Fix spurious E225 and E701 for function annotations. (Issue #29)</li> <li>Add E502 for explicit line join between brackets.</li> <li>Fix E901 when printing source with <code class="docutils literal notranslate"><span class="pre">--show-source</span></code>.</li> <li>Report all errors for each checker, instead of reporting only the first occurrence for each line.</li> <li>Option <code class="docutils literal notranslate"><span class="pre">--show-pep8</span></code> implies <code class="docutils literal notranslate"><span class="pre">--first</span></code>.</li> </ul> </div> <div class="section" id="id28"> <h3>1.1 (2012-05-24)<a class="headerlink" href="#id28" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li>Add E901 for syntax errors. (Issues #63 and #30)</li> <li>Add E271, E272, E273 and E274 for extraneous whitespace around keywords. (Issue #57)</li> <li>Add <code class="docutils literal notranslate"><span class="pre">tox.ini</span></code> configuration file for tests. (Issue #61)</li> <li>Add <code class="docutils literal notranslate"><span class="pre">.travis.yml</span></code> configuration file for continuous integration. (Issue #62)</li> </ul> </div> <div class="section" id="id29"> <h3>1.0.1 (2012-04-06)<a class="headerlink" href="#id29" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li>Fix inconsistent version numbers.</li> </ul> </div> <div class="section" id="id30"> <h3>1.0 (2012-04-04)<a class="headerlink" href="#id30" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li>Fix W602 <code class="docutils literal notranslate"><span class="pre">raise</span></code> to handle multi-char names. (Issue #53)</li> </ul> </div> <div class="section" id="id31"> <h3>0.7.0 (2012-03-26)<a class="headerlink" href="#id31" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li>Now <code class="docutils literal notranslate"><span class="pre">--first</span></code> prints only the first occurrence of each error. The <code class="docutils literal notranslate"><span class="pre">--repeat</span></code> flag becomes obsolete because it is the default behaviour. (Issue #6)</li> <li>Allow to specify <code class="docutils literal notranslate"><span class="pre">--max-line-length</span></code>. (Issue #36)</li> <li>Make the shebang more flexible. (Issue #26)</li> <li>Add testsuite to the bundle. (Issue #25)</li> <li>Fixes for Jython. (Issue #49)</li> <li>Add PyPI classifiers. (Issue #43)</li> <li>Fix the <code class="docutils literal notranslate"><span class="pre">--exclude</span></code> option. (Issue #48)</li> <li>Fix W602, accept <code class="docutils literal notranslate"><span class="pre">raise</span></code> with 3 arguments. (Issue #34)</li> <li>Correctly select all tests if <code class="docutils literal notranslate"><span class="pre">DEFAULT_IGNORE</span> <span class="pre">==</span> <span class="pre">''</span></code>.</li> </ul> </div> <div class="section" id="id32"> <h3>0.6.1 (2010-10-03)<a class="headerlink" href="#id32" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li>Fix inconsistent version numbers. (Issue #21)</li> </ul> </div> <div class="section" id="id33"> <h3>0.6.0 (2010-09-19)<a class="headerlink" href="#id33" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li>Test suite reorganized and enhanced in order to check more failures with fewer test files. Read the <code class="docutils literal notranslate"><span class="pre">run_tests</span></code> docstring for details about the syntax.</li> <li>Fix E225: accept <code class="docutils literal notranslate"><span class="pre">print</span> <span class="pre">>>sys.stderr,</span> <span class="pre">"..."</span></code> syntax.</li> <li>Fix E501 for lines containing multibyte encoded characters. (Issue #7)</li> <li>Fix E221, E222, E223, E224 not detected in some cases. (Issue #16)</li> <li>Fix E211 to reject <code class="docutils literal notranslate"><span class="pre">v</span> <span class="pre">=</span> <span class="pre">dic['a']</span> <span class="pre">['b']</span></code>. (Issue #17)</li> <li>Exit code is always 1 if any error or warning is found. (Issue #10)</li> <li><code class="docutils literal notranslate"><span class="pre">--ignore</span></code> checks are now really ignored, especially in conjunction with <code class="docutils literal notranslate"><span class="pre">--count</span></code>. (Issue #8)</li> <li>Blank lines with spaces yield W293 instead of W291: some developers want to ignore this warning and indent the blank lines to paste their code easily in the Python interpreter.</li> <li>Fix E301: do not require a blank line before an indented block. (Issue #14)</li> <li>Fix E203 to accept NumPy slice notation <code class="docutils literal notranslate"><span class="pre">a[0,</span> <span class="pre">:]</span></code>. (Issue #13)</li> <li>Performance improvements.</li> <li>Fix decoding and checking non-UTF8 files in Python 3.</li> <li>Fix E225: reject <code class="docutils literal notranslate"><span class="pre">True+False</span></code> when running on Python 3.</li> <li>Fix an exception when the line starts with an operator.</li> <li>Allow a new line before closing <code class="docutils literal notranslate"><span class="pre">)</span></code>, <code class="docutils literal notranslate"><span class="pre">}</span></code> or <code class="docutils literal notranslate"><span class="pre">]</span></code>. (Issue #5)</li> </ul> </div> <div class="section" id="id34"> <h3>0.5.0 (2010-02-17)<a class="headerlink" href="#id34" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li>Changed the <code class="docutils literal notranslate"><span class="pre">--count</span></code> switch to print to sys.stderr and set exit code to 1 if any error or warning is found.</li> <li>E241 and E242 are removed from the standard checks. If you want to include these checks, use switch <code class="docutils literal notranslate"><span class="pre">--select=E,W</span></code>. (Issue #4)</li> <li>Blank line is not mandatory before the first class method or nested function definition, even if there’s a docstring. (Issue #1)</li> <li>Add the switch <code class="docutils literal notranslate"><span class="pre">--version</span></code>.</li> <li>Fix decoding errors with Python 3. (Issue #13 <a class="footnote-reference" href="#id43" id="id35">[1]</a>)</li> <li>Add <code class="docutils literal notranslate"><span class="pre">--select</span></code> option which is mirror of <code class="docutils literal notranslate"><span class="pre">--ignore</span></code>.</li> <li>Add checks E261 and E262 for spaces before inline comments.</li> <li>New check W604 warns about deprecated usage of backticks.</li> <li>New check W603 warns about the deprecated operator <code class="docutils literal notranslate"><span class="pre"><></span></code>.</li> <li>Performance improvement, due to rewriting of E225.</li> <li>E225 now accepts:<ul> <li>no whitespace after unary operator or similar. (Issue #9 <a class="footnote-reference" href="#id43" id="id36">[1]</a>)</li> <li>lambda function with argument unpacking or keyword defaults.</li> </ul> </li> <li>Reserve “2 blank lines” for module-level logical blocks. (E303)</li> <li>Allow multi-line comments. (E302, issue #10 <a class="footnote-reference" href="#id43" id="id37">[1]</a>)</li> </ul> </div> <div class="section" id="id38"> <h3>0.4.2 (2009-10-22)<a class="headerlink" href="#id38" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li>Decorators on classes and class methods are OK now.</li> </ul> </div> <div class="section" id="id39"> <h3>0.4 (2009-10-20)<a class="headerlink" href="#id39" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li>Support for all versions of Python from 2.3 to 3.1.</li> <li>New and greatly expanded self tests.</li> <li>Added <code class="docutils literal notranslate"><span class="pre">--count</span></code> option to print the total number of errors and warnings.</li> <li>Further improvements to the handling of comments and blank lines. (Issue #1 <a class="footnote-reference" href="#id43" id="id40">[1]</a> and others changes.)</li> <li>Check all py files in directory when passed a directory (Issue #2 <a class="footnote-reference" href="#id43" id="id41">[1]</a>). This also prevents an exception when traversing directories with non <code class="docutils literal notranslate"><span class="pre">*.py</span></code> files.</li> <li>E231 should allow commas to be followed by <code class="docutils literal notranslate"><span class="pre">)</span></code>. (Issue #3 <a class="footnote-reference" href="#id43" id="id42">[1]</a>)</li> <li>Spaces are no longer required around the equals sign for keyword arguments or default parameter values.</li> </ul> <table class="docutils footnote" frame="void" id="id43" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> <tr><td class="label">[1]</td><td><em>(<a class="fn-backref" href="#id35">1</a>, <a class="fn-backref" href="#id36">2</a>, <a class="fn-backref" href="#id37">3</a>, <a class="fn-backref" href="#id40">4</a>, <a class="fn-backref" href="#id41">5</a>, <a class="fn-backref" href="#id42">6</a>)</em> These issues refer to the <a class="reference external" href="http://github.com/cburroughs/pep8.py/issues">previous issue tracker</a>.</td></tr> </tbody> </table> </div> <div class="section" id="id45"> <h3>0.3.1 (2009-09-14)<a class="headerlink" href="#id45" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li>Fixes for comments: do not count them when checking for blank lines between items.</li> <li>Added setup.py for pypi upload and easy_installability.</li> </ul> </div> <div class="section" id="id46"> <h3>0.2 (2007-10-16)<a class="headerlink" href="#id46" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li>Loads of fixes and improvements.</li> </ul> </div> <div class="section" id="id47"> <h3>0.1 (2006-10-01)<a class="headerlink" href="#id47" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li>First release.</li> </ul> </div> </div> </div> </div> </div> <footer> <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> <a href="api.html" class="btn btn-neutral" title="pep8 API" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a> </div> <hr/> <div role="contentinfo"> <p> © Copyright 2006-2016, Johann C. Rocholl, Florent Xicluna, Ian Lee </p> </div> Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. </footer> </div> </div> </section> </div> <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script> <script type="text/javascript" src="_static/jquery.js"></script> <script type="text/javascript" src="_static/underscore.js"></script> <script type="text/javascript" src="_static/doctools.js"></script> <script type="text/javascript" src="_static/language_data.js"></script> <script type="text/javascript" src="_static/js/theme.js"></script> <script type="text/javascript"> jQuery(function () { SphinxRtdTheme.Navigation.enable(true); }); </script> </body> </html>