{"id":3491,"library":"flake8-import-order","title":"Flake8 Import Order Plugin","description":"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.","status":"active","version":"0.19.2","language":"en","source_language":"en","source_url":"https://github.com/PyCQA/flake8-import-order","tags":["flake8","linter","code-quality","import-order","pylama"],"install":[{"cmd":"pip install flake8-import-order","lang":"bash","label":"Install via pip"}],"dependencies":[{"reason":"This library is a plugin for Flake8 and requires it to function.","package":"flake8"},{"reason":"Can also integrate with Pylama as an alternative code audit tool.","package":"pylama","optional":true},{"reason":"A core dependency of Flake8, often implicitly installed.","package":"pycodestyle","optional":true}],"imports":[{"note":"flake8-import-order is a plugin for Flake8; it is not typically imported directly in Python code. Its functionality is enabled and configured via Flake8's configuration files (e.g., .flake8, pyproject.toml).","symbol":"N/A","correct":"N/A"}],"quickstart":{"code":"# 1. Create a Python file (e.g., my_module.py):\n#    import os\n#    import pytest\n#    from my_app import utils\n#    import sys\n#\n# 2. Create a Flake8 configuration file (e.g., .flake8):\n#    [flake8]\n#    import-order-style = google\n#    application-import-names = my_app,my_other_app\n\n# To run the check:\n# flake8 my_module.py\n#\n# Expected output for the example above:\n# my_module.py:2:1: I100 Your import statements are in the wrong order.\n# my_module.py:3:1: I201 Missing newline between import groups.","lang":"python","description":"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."},"warnings":[{"fix":"Upgrade Python to 3.9 or newer, or pin `flake8-import-order<0.19.0` for older Python versions.","message":"Version 0.19.0 dropped support for Python 3.7 and 3.8. Ensure your Python environment is 3.9+ when upgrading to 0.19.0 or newer.","severity":"breaking","affected_versions":"0.19.0+"},{"fix":"Add `application-import-names = your_app_name1,your_app_name2` to your Flake8 config (e.g., `.flake8` or `pyproject.toml`).","message":"For correct classification of local application imports, you *must* configure `application-import-names` and optionally `application-package-names` in your Flake8 configuration. Without this, your own modules might be incorrectly flagged as third-party.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Be aware of this limitation; for edge cases, manual `noqa` comments might be necessary.","message":"The standard library module list used for classification is vendored and static across all Python versions. This might lead to incorrect classifications if your specific Python environment has a different set of standard library modules (e.g., very old or very new Python versions).","severity":"gotcha","affected_versions":"All versions"},{"fix":"Structure your code to place imports at module scope where possible. Manual review is needed for complex conditional import patterns.","message":"The plugin primarily checks module-scope imports. Conditional imports (e.g., inside `if` blocks) are generally ignored, with the exception of imports within `if TYPE_CHECKING:` blocks.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}