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

Thomas Kluyver takowl at gmail.com
Mon Oct 6 18:35:33 EDT 2014


Thanks Raghav! From the conversation on your issue, it looks like it might
make sense for your code to live as a flake8 extension.

Thomas

On 6 October 2014 01:18, Raghav Rv <rvraghav93 at gmail.com> wrote:

> 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
> <http://stackoverflow.com/questions/26205629>.
>
> [ 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
> <http://nbviewer.ipython.org/github/rvraghav93/Data-Structures-By-Horowitz-in-Python/blob/master/Chapter%208/Chapter%208%20-%20Hashing.ipynb>
> .
>
> 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>
>
> Thanks
> Raghav Rv ( rvraghav93 )
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20141006/aeba5be0/attachment.html>


More information about the IPython-dev mailing list