skillfed

flake8-import-order

Flake8 and pylama plugin that checks the ordering of import statements.

flake8-import-order v0.19.2 1.6M downloads/30d#3,729 on PyPI281
Copyleft license LGPLv3 Active released

What it is and what it does

flake8-import-order is a flake8 plugin that validates how imports are organized in Python code. It enforces grouping conventions—typically stdlib first, then third-party packages, then local code—and checks that each group is properly sorted. The plugin supports multiple built-in styles including cryptography (the default), google, smarkets, appnexus, edited, pycharm, and pep8, and allows you to define custom styles by extending the base class.

You configure it by specifying which names belong to your application and optionally which packages are internal to your organization. It reports four warning types: I100 (imports out of order), I101 (names within a from-import out of order), I201 (missing blank line between groups), and I202 (extra blank line within a group). Checks operate only at module scope and ignore conditional imports except those under TYPE_CHECKING blocks.

Use it for:

  • Enforce consistent import organization across a team to improve code readability
  • Integrate import ordering checks into CI/CD pipelines with other flake8 rules
  • Adopt a specific import style and automatically flag deviations in code review
  • Define a custom import style for your organization and register it as an entry point

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

A flake8 plugin that enforces import ordering and grouping according to configurable conventions, reporting violations through four warning codes.

Yes, if you use flake8 and want automated import ordering enforcement. The plugin is actively maintained, has no known vulnerabilities, and imposes minimal installation friction. The LGPLv3 copyleft license is a consideration only if you plan to redistribute the code; for typical development use it is not a barrier.

Install

flake8-import-order on PyPI

pip

pip install flake8-import-order

uv

uv add flake8-import-order

poetry

poetry add flake8-import-order

Installing flake8-import-order

Before you install

Low friction installation as a pure Python wheel with only pycodestyle and setuptools as runtime dependencies. The project is actively maintained with recent commits since its initial release.

License in practice

Licensed under LGPLv3 (copyleft), which requires derivative works to be distributed under the same license terms. This may restrict redistribution or embedding in proprietary code.

Quickstart

pip install flake8-import-order

Add to .flake8 config:
[flake8]
import-order-style = cryptography
application-import-names = myapp

Verify before relying

  • Whether performance is acceptable on large codebases with many imports
  • Exact Python version compatibility beyond the classifiers listed

Package facts

License LGPLv3 (copyleft)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 2 — pycodestyle, setuptools
Maintenance actively maintained — 416 days since the last release
Last repo commit
First released
Downloads 1,597,532/month — #3,729 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: flake8_import_order-0.19.2-py3-none-any.whl

Development Status :: 4 - BetaFramework :: Flake8Intended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: Quality Assurance

Tags

flake8 import order pluginpython import linterimport grouping checkercode style validationflake8 import checker
lintingcode-style

More Python Modules packages