[Biopython-dev] Fwd: git pre-commit hook for PEP8 style checking
twrig002 at ucr.edu
Mon Oct 20 15:50:11 UTC 2014
Forgot reply to all.
Just ran pep8 on the latest commit and got almost 30,000 errors. Looks like
we have our work cut out for us. Should we discuss formatting choices for
docstrings before starting on the PEP8 corrections so that both can be
updated at the same time as we go through the code? Or should the tasks be
On Mon, Oct 20, 2014 at 8:02 AM, Christian Brueffer <christian at brueffer.de>
> Hi Peter,
> indeed, there is more than one way to install pep8. Windows feedback
> would be great, I don't have a test machine for that.
> One nice feature of pep8 is getting overall statistics with pep8
> --statistics -qq from the top level repository directory. Maybe it would
> be interesting to set up a job to automatically send these statistics to
> this list in certain intervals (i.e., once a month).
> On 2014-10-20 13:31, Peter Cock wrote:
>> Thanks Christian,
>> I'm giving that a try on my mac - note you don't need pip to install pep8,
>> $ curl -O https://pypi.python.org/packages/source/p/pep8/pep8-1.
>> $ tar -zxvf pep8-1.5.7.tar.gz
>> $ md5 pep8-1.5.7.tar.gz
>> MD5 (pep8-1.5.7.tar.gz) = f6adbdd69365ecca20513c709f9b7c93
>> $ cd pep8-1.5.7
>> $ sudo python setup.py install
>> $ which pep8
>> $ head -n 1 /usr/local/bin/pep8
>> $ pep8 --version
>> Note we want pep8 installed as a binary on the path (which is itself
>> a Python script). This is then called by git via the pre-commit hook -
>> the hook from Christian is another Python script (using the default
>> system python) which calls the pep8 binary.
>> I would hope this is doable on Windows too...
>> On Mon, Oct 20, 2014 at 11:32 AM, Christian Brueffer
>> <christian at brueffer.de> wrote:
>>> Hi everyone,
>>> TL;DR: lots of style problems in biopython code, please consider using
>>> git pre-commit hook at https://github.com/cbrueffer/pep8-git-hook (or
>>> your files manually with the pep8 utility).
>>> Long version:
>>> Since the last round of PEP8 fixes to the biopython repo almost two years
>>> ago, many classes of inconsistencies have unfortunately slowly crept back
>>> One way to check the code you're committing is via a git pre-commit hook,
>>> which tells you which kinds of problems your submissions contain.
>>> Such a commit hook can be found here:
>>> Installation is easy, simply copy the pre-commit file from the above
>>> repository into the following directory in your biopython checkout:
>>> You also need the pep8 utility (pip install pep8).
>>> A list of problem classes pep8 reports can be found here:
>>> By default the hook checks for all of these problems, except the
>>> ones: E121-E129, E131, and E501 (indentation and long lines).
>>> The way it works is, the hook stops your commit and tells you which
>>> your code contains. The hook won't bother you if the files in the commit
>>> contain no issues, or you commit with --no-verify (e.g., git commit -a
>>> --no-verify). The latter is especially for situations where your code is
>>> fine, but files contain pre-existing issues.
>>> Please test this and let me know what you think, whether the list of
>>> should be adapted etc. Continuous checking would improve our code
>>> consistency a lot in the long run.
>>> Biopython-dev mailing list
>>> Biopython-dev at mailman.open-bio.org
> Biopython-dev mailing list
> Biopython-dev at mailman.open-bio.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Biopython-dev