Is your script/code looks dull and not in order? If yes, then its time to use pycodestyle!!
Pycodestyle (formerly known as PEP8) is a syntax and style checker tool for Python language. In this blog, I’ve documented step by step procedure to install this with Sublime Text.
Before we start, let us briefly understand more about linter. Lint or linter is a tool that analyzes source code to flag programming errors, bugs, stylistic errors. To know more please check out the wiki link
Pycodestyle is one of the linter plugins available for Sublime Text. To install this plugin, first, we need to install Sublime Linter plugin.
- Sublime Text
***This step by step procedure to apply to Debian and Debian based Linux Operation Systems.***
Steps to install pycodestyle:
- Install system package using pip or apt
$pip3 install pycodestyle OR $sudo apt install python3-pycodestyle $which pycodestyle # shows the location where pycode style is
2. Install pycodestyle plugin in sublime text
a. Open package control (CTRL+SHIFT+P), type 'install package' and hit 'ENTER' # It takes some time to load repositories.
b. Type 'sublimelinter-pycodestyle' and Click on the first option as shown below. After installation, a new tab window will open showing installed plugin information
C. To configure sublime-linter settings, goto Preferences > Package Settings > SublimeLinter > Settings
d. In the Sublime Linter settings, make sure @disable: false is set s shown in below screenshot.
e. To test pycodestyle, create a new file and save it as test.py. Start writing the code, Pycodestyle will automatically start showing the errors while you are typing in the console message.
That’s it!! Your code looks more disciplined of course after fixing the errors 🙂
In addition to pycodestyle, try pylint, pyflakes and pydocstyle plugins as shown above. These plugins improve Code Quality by following Python Coding Standards. Following best practices will make you a good scripter/developer and remember Quality Matters!!
So go ahead and use pycodestyle. Use the above references to deep dive and learn more about this plugin which is a ‘Must Have’ for the Sublime Text. Happy Pythonic way of coding!!