Flake8 and pylama plugin that checks the ordering of import statements.
Project description
A flake8 and Pylama plugin that checks the ordering of your imports.
In general stdlib comes first, then 3rd party, then local packages, and that each group is indivudually alphabetized, see Configuration section for details.
It will not check anything else about the imports. Merely that they are grouped and ordered correctly.
This plugin is under somewhat active development and is heavily influenced by the personal preferences of the developers of cryptography. Expect seemingly random changes and configuration changes as we figure out how it should work.
Warnings
This package adds 3 new flake8 warnings
I100: Your import statements are in the wrong order.
I101: The names in your from import are in the wrong order.
I201: Missing newline between sections or imports.
Configuration
You will want to set the application-import-names option to a comma separated list of names that should be considered local to your application. These will be used to help categorise your import statements into the correct groups.
import-order-style controls what style the plugin follows (cryptography is the default):
cryptography - see an example
google - style described in Google Style Guidelines, see an example
Limitations
Currently these checks are limited to module scope imports only. Conditional imports in module scope will also be ignored. The classification of an import as being non-stdlib of some kind depends on that package actually being installed.
I103 only checks that groups of imports are not consecutive and only takes into account the first line of each import statement. This means that multi-line from imports, comments between imports and so on may cause this error not to be raised correctly in all situations. This restriction is due to the data provided by the stdlib ast module.
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-import-order-0.6.1.tar.gz
.
File metadata
- Download URL: flake8-import-order-0.6.1.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91084b5385092d31900b19a60661c686f7b8072f269c01885d917a91d4ab25e3 |
|
MD5 | 3c13a691096f2eac24a2097028fb1ce4 |
|
BLAKE2b-256 | 7f8036dd9af5e154a6741f4313362a4b642745885899b922774c0220fae78bc2 |
Provenance
File details
Details for the file flake8_import_order-0.6.1-py2.py3-none-any.whl
.
File metadata
- Download URL: flake8_import_order-0.6.1-py2.py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37c1ffa945e7d75b99960073d9ace5e5ba8813ed2d12146ec5fa097bdba37aaa |
|
MD5 | 5ecc36830d98384018e87d7e424f2a40 |
|
BLAKE2b-256 | d968dc87c4f8331ce4cd81c33c9e21365dfc563021e04dba3a6406ff6903355e |