flake8-import-order
Flake8 and pylama plugin that checks the ordering of import statements.
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-orderuv
uv add flake8-import-orderpoetry
poetry add flake8-import-orderInstalling 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
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
flake8-isortIntegrates isort into flake8 linting, reporting…
copyleft · top 5,000 on PyPI
flake8-tidy-importsA flake8 plugin that detects and reports…
permissive · top 15,000 on PyPI
flake8-pep585A flake8 plugin that detects and flags…
copyleft · top 15,000 on PyPI
flake8-typing-importsA flake8 plugin that detects unguarded typing…
permissive · top 15,000 on PyPI
flake8Flake8 is a command-line tool that combines…
permissive · top 1,000 on PyPI
pyflakesPyflakes checks Python source files for logical…
permissive · top 1,000 on PyPI
flake8-commasA flake8 plugin that enforces trailing comma…
permissive · top 15,000 on PyPI
flake8-type-checkingA flake8 plugin that identifies which imports…
permissive · top 15,000 on PyPI
flake8-banditIntegrates bandit security checks into flake8…
permissive · top 15,000 on PyPI
classify-importsParses, classifies, and sorts Python import…
permissive · top 15,000 on PyPI