Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
176 views
in Technique[技术] by (71.8m points)

python - Verifying PEP8 in iPython notebook code

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

question from:https://stackoverflow.com/questions/26126853/verifying-pep8-in-ipython-notebook-code

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

In case this helps anyone, I'm using:

conttest "jupyter nbconvert notebook.ipynb --stdout --to script | flake8 - --ignore=W391"

  • conttest reruns when saving changes to the notebook
  • flake8 - tells flake8 to take input from stdin
  • --ignore=W391 - this is because the output of jupyter nbconvert seems to always have a "blank line at end of file", so I don't want flake8 to complain about that.

I'm having a problem with markdown cells (whose line lengths may legitimately be quite long, though): ignore markdown cells in `jupyter nbconvert` with `--to script`.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...