Flake8 Import Order Plugin

0.19.2 · active · verified Sat Apr 11

A Flake8 and Pylama plugin that checks the ordering of import statements in Python code. It ensures imports are grouped (standard library, third-party, local) and typically alphabetized within groups, though the exact rules depend on the configured style. The current version is 0.19.2, and it maintains an active release cadence with regular updates.

Warnings

Install

Imports

Quickstart

Install the plugin, then configure Flake8 to use a specific import order style and define your application's import names. Run `flake8` on your Python files to see import order violations.

# 1. Create a Python file (e.g., my_module.py):
#    import os
#    import pytest
#    from my_app import utils
#    import sys
#
# 2. Create a Flake8 configuration file (e.g., .flake8):
#    [flake8]
#    import-order-style = google
#    application-import-names = my_app,my_other_app

# To run the check:
# flake8 my_module.py
#
# Expected output for the example above:
# my_module.py:2:1: I100 Your import statements are in the wrong order.
# my_module.py:3:1: I201 Missing newline between import groups.

view raw JSON →