Using linting tools and style guides to write accurate, well-formed code
A variety of tools exist for the modern Python programmer to use to improve their code and ensure consistency of style. Many times, these tools are run automatically when checking code as part of CI/CD (continuous integration/continuous deployment). Many organizations also adopt style guides that go beyond just “does the code work” to specify how code would be written to be understandable and visually clear. Linting is a process for analyzing code syntax and style inconsistencies. PyLint is a popular Python tool for this.One of the most popular style guides to know about for Python is PEP8. This style is enforced by many programs such as PyLint, and PyCodeStyle which we will use in our Jupyter notebook.In this recipe we will learn about a few common tools for style enforcement in Python and learn to run them both from the terminal and from within our notebooks.
Getting ready
- First, we’ll install...