[IPython-dev] PEP8 Check For IPython Notebook - A small work around

Raghav Rv rvraghav93 at gmail.com
Mon Oct 6 04:18:39 EDT 2014

Hi all,

I recently modified the pep8 project a little to allow pep8 checks to be
run on ipython notebook, inspired by this stack overflow post

[ Though we do have an extension that can check for pep8 on a per-cell
basis, this modification can help us run pep8 for a whole ".ipynb" file. ]

Using the --format="ipynb" flag we can get the line number offset (
calculated for each individual cell ) and the cell number in the error
report, to easily locate errors.

This is the pull request : https://github.com/jcrocholl/pep8/pull/337

( Looks like this won't be merged as the devs of pep8 feel this is out of
scope for the project. )

I am just posting it here ( as advised by Matt ), just incase someone finds
it useful ...

Sample Notebook

Result of running : `python pep8.py --format="ipynb" notebook.ipynb` on the
above notebook. ( Output seems to be consistent with that of the pep8 check
on the converted ".py" file )

Output <https://gist.github.com/rvraghav93/61f98948a4e0464d2cd3>

Raghav Rv ( rvraghav93 )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20141006/a1429f1e/attachment.html>

More information about the IPython-dev mailing list