Is there any way to use pep8 module to check whether the code is compliant with pep8 specifications in Spyder (Anaconda)?
I also tried to run the command pep8 --show-source --show-pep8 testsuite/E40.py
given at https://pypi.org/project/pep8/ in the command prompt, but it gives syntax error (SyntaxError: invalid syntax
).
Spyder's code analyzer is powered by the best-in-class Pylint back-end, which can intelligently detect an enormous and customizable range of potential errors, bad practices, quality issues, style violations, and more.
Simply go to Tools > Preferences then choose Completion and linting > Code style and formatting . There, toggle on Enable code style linting and Autoformat files on save . Now when you save your file, Spyder will beautify your code, when it can infer what to do.
(Spyder maintainer here) You can activate pep8 support in Spyder 3 by going to
Tools > Preferences > Editor > Code Introspection/Analysis
and activating the option called
Real-time code style analysis
This will show pep8 warnings directly in our Editor, so you don't need to run pep8
from the command line to see them.
Amendment to Carlos response: In Spyder 4 this option has been moved to
Tools > Preferences > Completion and linting > Code style
where you have to accept
Enable code style linting
FYI, in this new version specific errors or warnings can be selected to be shown or ignored!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With