pythonjupyter-notebookpylintlinter

How to use Pylint or other linters with Jupyter Notebooks?


Is it possible to have a linter inside of a Jupyter Notebook?


Solution

  • # install
    !pip install pycodestyle pycodestyle_magic
    
    
    # load
    %load_ext pycodestyle_magic
    
    
    # use
    %%pycodestyle
    def square_of_number(
         num1, num2, num3, 
         num4):
        return num1**2, num2**2, num3*
    
    # Output
    2:1: E302 expected 2 blank lines, found 0
    3:23: W291 trailing whitespace