Verifying PEP8 in iPython notebook code

后端 未结 4 1929
醉酒成梦
醉酒成梦 2020-12-12 22:16

Is there an easy way to check that iPython notebook code, while it\'s being written, is compliant with PEP8?

4条回答
  •  [愿得一人]
    2020-12-12 22:49

    Install the pep8 extension for ipython notebook using the following command :

    %install_ext https://raw.githubusercontent.com/SiggyF/notebooks/master/pep8_magic.py
    

    Refer the official docs for more info.

    After that use the %%pep8 Cell magic function to check your particular cell for pep8 styling.

    Note that this has to be put inside every cell for which pep8 checking needs to be enforced.

    Refer this example.

提交回复
热议问题