Skip to main content

flake8 plugin that integrates isort

Project description

https://github.com/gforcada/flake8-isort/actions/workflows/tests.yml/badge.svg?branch=main https://coveralls.io/repos/gforcada/flake8-isort/badge.svg?branch=main

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.9, 3.10, 3.11, 3.12, 3.13 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flake8_isort-7.0.0.tar.gz (17.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flake8_isort-7.0.0-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file flake8_isort-7.0.0.tar.gz.

File metadata

  • Download URL: flake8_isort-7.0.0.tar.gz
  • Upload date:
  • Size: 17.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for flake8_isort-7.0.0.tar.gz
Algorithm Hash digest
SHA256 a677199d1197f826eb69084e7ac272f208f4583363285f43111c34272abe7e5d
MD5 10653edc7d90691e76eff8ecaa146948
BLAKE2b-256 57a44b170983fd2e9b5ecc40c88738db6dfb77e069c71be9a81f9893cdb8a0cc

See more details on using hashes here.

File details

Details for the file flake8_isort-7.0.0-py3-none-any.whl.

File metadata

  • Download URL: flake8_isort-7.0.0-py3-none-any.whl
  • Upload date:
  • Size: 18.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for flake8_isort-7.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c301a0e55fc77582348e636194b84b1a0baf0dfdaa6eddf3b0eeea75f8be7f36
MD5 448abf43ffe0959a25fa7b04d0347c82
BLAKE2b-256 177d907ef4135f6ede5187930d9ddd1f36564e07c6cdcd15ae8fb9849c9517e0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page