flake8 plugin that integrates isort
Project description
Flake8 meet isort
Use isort to check if the imports on your python files are sorted the way you expect.
Add an .isort.cfg to define how you want your imports sorted and run flake8 as you usually do.
See isort documentation for .isort.cfg available options.
Install
Install with pip:
$ pip install flake8-isort
Install with conda:
$ conda install -c conda-forge flake8-isort
Configuration
If using the select option from flake8 be sure to enable the I category as well, see below for the specific error codes reported by flake8-isort.
See flake8 --help for available flake8-isort options.
Error codes
Error code |
Description |
---|---|
I001 |
isort found an import in the wrong position |
I002 |
no configuration found (.isort.cfg or [isort] in configs) |
I003 |
isort expected 1 blank line in imports, found 0 |
I004 |
isort found an unexpected blank line in imports |
I005 |
isort found an unexpected missing import |
Requirements
Python 3.8, 3.9, 3.10, 3.11 and pypy3
flake8
isort
Relation to flake8-import-order
As an alternative to this flake8 plugin, there’s flake8-import-order that could be worth checking out. In contrast to this plugin that defers all logic to isort, the flake8-import-order comes bundled with it’s own logic.
flake8-import-order comes with a few predefined set of styles meanwhile this plugin can be customized a bit more. But the biggest difference could lie in that flake8-isort actually has the corresponding sorting engine isort that can sort the import orders of your existing python files. Meanwhile flake8-import-order has no such corresponding tool, hence big existing projects who want to adopt either would get a more automized experience choosing flake8-isort.
License
GPL 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file flake8_isort-6.1.1.tar.gz
.
File metadata
- Download URL: flake8_isort-6.1.1.tar.gz
- Upload date:
- Size: 17.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1f82f3cf06a80c13e1d09bfae460e9666255d5c780b859f19f8318d420370b3 |
|
MD5 | 1c3910088e5353d9da6fdb0546e1d5a0 |
|
BLAKE2b-256 | e635e6b342f91a05d73e632485a5623ea576a4171acb213cce8f2fe4adbe3295 |
File details
Details for the file flake8_isort-6.1.1-py3-none-any.whl
.
File metadata
- Download URL: flake8_isort-6.1.1-py3-none-any.whl
- Upload date:
- Size: 18.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0fec4dc3a15aefbdbe4012e51d5531a2eb5fa8b981cdfbc882296a59b54ede12 |
|
MD5 | 94cd305e1179a436158e16570cd6e8cb |
|
BLAKE2b-256 | 82d218aee7242bf5bc0d780d88009657c9169d042044d3cb3e05898429d474e6 |