Forrest logo
tool overview
On this page you find all important commands for the CLI tool pycodestyle. If the command you are looking for is missing please ask our AI.

pycodestyle

Pycodestyle is a command-line tool that assists in enforcing Python coding style conventions. It checks Python source code and reports violations against the PEP 8 style guide. The tool was formerly known as "pep8" but was renamed to Pycodestyle with the 2.0.0 release. It supports Python versions 2.7 and newer, including Python 3.x. Pycodestyle helps maintain consistent code style across Python projects, making it easier for teams to collaborate and understand each other's code. It detects various style violations such as indentation errors, line length exceeding the recommended limit, missing whitespace around operators, improper naming conventions, and more. Running Pycodestyle is simple; you just need to provide the path to the Python script(s) or directory where your code is located. By default, it recursively checks all the Python files in the given directory. It can also be integrated into popular code editors, making it convenient to check code style on the fly while writing code. Pycodestyle produces an output with line numbers and descriptions of violations found, making it easy to identify and fix the styling issues. It supports various command-line options to customize its behavior, such as ignoring specific error codes, excluding specific directories or files, selecting specific error checks, and more. Among the options Pycodestyle provides, you can also use the "--show-source" option to display the code snippet causing the violation alongside the error message for better context. Additionally, it supports an auto-fix mode with the "--aggressive" option, which can attempt to automatically fix certain style violations. The tool has gained popularity and is widely used in the Python community as an essential part of the development workflow. It helps improve code quality, readability, and maintainability by promoting consistent coding style practices. The Pycodestyle project is actively maintained and deeply integrated with the Python ecosystem.

List of commands for pycodestyle:

  • pycodestyle:tldr:1887c pycodestyle: Check the style of multiple files.
    $ pycodestyle ${file1-py} ${file2-py} ${file3-py}
    try on your machine
    explain this command
  • pycodestyle:tldr:37a2d pycodestyle: Show only the first occurrence of an error.
    $ pycodestyle --first ${file-py}
    try on your machine
    explain this command
  • pycodestyle:tldr:3ad72 pycodestyle: Show the specific PEP 8 text for each error.
    $ pycodestyle --show-pep8 ${file-py}
    try on your machine
    explain this command
  • pycodestyle:tldr:789cf pycodestyle: Check the style of a single file.
    $ pycodestyle ${file-py}
    try on your machine
    explain this command
  • pycodestyle:tldr:7aff3 pycodestyle: Show the source code for each error.
    $ pycodestyle --show-source ${file-py}
    try on your machine
    explain this command
tool overview