flake8-isort is a flake8 plugin that integrates the isort library to check the order of imports in Python files. It leverages isort's sorting logic and configuration (e.g., via .isort.cfg or pyproject.toml) to report import style violations as flake8 errors. Regularly maintained, its current version is 7.0.0, released in October 2025.
pip install flake8-isort flake8 isortNo compatibility data collected yet for this library.
To use flake8-isort, first install it along with flake8 and isort. Then, create an `isort` configuration file (e.g., `.isort.cfg` or within `pyproject.toml`) to define your preferred import sorting style. Finally, run `flake8` as you normally would; `flake8-isort` will automatically detect and report import order issues based on your `isort` configuration.
Upgrade Python to 3.10+ and install `isort` 7.0.0+. Refer to the `CHANGES.rst` for detailed compatibility matrix.
Ensure `flake8` is at version 6.0.0+ and `isort` is at version 5.0.0+ (or 7.0.0+ for `flake8-isort` 7.0.0).
Create a configuration file for `isort` in your project root or specify its location using `isort --settings-file`.
Choose one plugin based on your preference (e.g., `flake8-isort` if you also use `isort` to fix imports).
Add 'I' to your `flake8` `select` configuration or remove the `select` option to run all checks.
Run `isort .` from your project's root directory to automatically reorder imports across your project, or manually adjust the import order to comply with isort's standards, potentially configured in a `.isort.cfg` or `pyproject.toml` file.
To resolve this, ensure that your `flake8-isort` version is compatible with your `isort` version. You might need to either downgrade `isort` to a version compatible with your `flake8-isort` (e.g., `pip install 'isort<5'`) or upgrade `flake8-isort` to a version that supports your current `isort` version (e.g., `pip install --upgrade flake8-isort`).
Create a configuration file (e.g., `pyproject.toml` or `.isort.cfg`) in your project's root directory and add a `[tool.isort]` or `[isort]` section with your desired settings to define how isort should organize imports.
Verify your `flake8` configuration (e.g., in `.flake8` or `pyproject.toml`). Ensure that `I` is included in the `select` option (e.g., `select = E,F,W,I`) and not listed in the `ignore` option within the `[flake8]` section.