<div dir="ltr">Hi all,<div><br></div><div>I recently modified the pep8 project a little to allow pep8 checks to be run on ipython notebook, inspired by <a href="http://stackoverflow.com/questions/26205629">this stack overflow post</a>.</div><div><br></div><div>[ 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. ]</div><div><br></div><div>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.</div><div><br></div><div>This is the pull request : <a href="https://github.com/jcrocholl/pep8/pull/337">https://github.com/jcrocholl/pep8/pull/337</a></div><div><br></div><div>( Looks like this won't be merged as the devs of pep8 feel this is out of scope for the project. )</div><div><br></div><div>I am just posting it here ( as advised by Matt ), just incase someone finds it useful ... </div><div><br></div><div>Sample <a href="http://nbviewer.ipython.org/github/rvraghav93/Data-Structures-By-Horowitz-in-Python/blob/master/Chapter%208/Chapter%208%20-%20Hashing.ipynb">Notebook</a>.</div><div><br></div><div>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 )</div><div><br></div><div><a href="https://gist.github.com/rvraghav93/61f98948a4e0464d2cd3">Output</a></div><div><br></div><div>Thanks</div><div>Raghav Rv ( rvraghav93 )<br></div></div>