Spoqa's import order style for flake8-import-order
Project description
This extends flake8-import-order to implement Spoqa’s import order convention. It bascially follows PEP 8 with our some additional rules:
Standard libraries shouldn’t be imported using from ... import ... statement. It’s because standard libraries tend to use general terms like open. We instead use always qualified imports to eliminate name pollution:
import sys # Yes from sys import version_info # No
However, there are few exceptions like typing module. They can be imported in both ways:
import typing from typing import Optional # `from ... import ...` must be latter
All other than standard libraries should be imported using from ... import ... statement:
from flask import Flask # Yes import flask # No
Deeper relative imports should go former. This rule makes consistent even when relative imports are rewritten as absolute imports.
from ..deeper import former from ...deepest import later
Imported names are splited to three categories: CONSTANT_NAME, ClassName, and normal_names, and follow that order:
from something import CONST_A, CONST_B, ClassA, ClassB, any_func, any_var
Usage
Install the flake8-import-order-spoqa using pip, and then specify --import-order-style=spoqa option. Or you can specify it on the config file as well:
[flake8]
import-order-style = spoqa
Because runtime extensible styles is introduced from flake-import-order 0.12, you need to install flake-import-order 0.12 or later.
Distribution
Written by Hong Minhee, and distributed under GPLv3 or later.
Changelog
Version 1.0.0
Initial release. Released February 12, 2017.
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
Hashes for flake8-import-order-spoqa-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42ef8b131c5ef873a5a4a72621fda38b09ee5bbf0b4f1692af5161e4cc5d0c70 |
|
MD5 | 29332897b6b0bfd22f6857d217c33c8b |
|
BLAKE2b-256 | b12555a4fd86f47134b667a6077f4b83e0f85f32576c9960c36f9686fc681785 |
Hashes for flake8_import_order_spoqa-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d15aaab6e19ae8b1a13f3a232c519a5922ad1141cf97b7a1b336b7a3f576b86f |
|
MD5 | 68c0a2544f5129555e82228fb6c8948b |
|
BLAKE2b-256 | e5f417e87dd5b82656e6987532e49e33a64ca04f2579e2bd41a1ee952e812064 |