Spoqa's import order style for flake8-import-order
This extends flake8-import-order to implement Spoqa’s import order convention. It basically 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
[flake8] import-order-style = spoqa
Released on August 31, 2018.
- The dataclasses module, like typing, now can be imported without a qualifier (e.g., from dataclasses import ...).
Released on August 6, 2018.
- Python 3.7 can be supported by updating flake8-import-order to 0.18. See its changelog to know more about updates.
Released on May 22, 2018.
- Python 3.3 became no more supported.
Released on February 12, 2018.
- Older versions than flake8-import-order 0.17 are now unsupported. (Under the hood, since flake8-import-order 0.17 refactored their internals so that constants like IMPORT_3RD_PARTY, IMPORT_APP, IMPORT_APP_PACKAGE, IMPORT_APP_RELATIVE, and IMPORT_STDLIB are evolved to ImportType enum type, flake8-import-order-spoqa also became to follow that.) [#3]
Released on November 27, 2017.
- Older versions than flake8-import-order 0.16 are now unsupported. (Under the hood, since flake8-import-order 0.16 refactored their internals so that no more Style.check() method and Style.imports property exist, flake8-import-order-spoqa also became to follow that.)
Released on October 31, 2017.
- Older versions than flake8-import-order 0.14.2 are now unsupported.
Released on October 31, 2017.
- Fixed incompatibility with flake8-import-order 0.14.1 or higher.
Released on July 15, 2017.
- Fixed a bug that wrong order of names (e.g. from ... import second, first) had been not warned.
Initial release. Released on February 12, 2017.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size flake8_import_order_spoqa-1.5.0-py2.py3-none-any.whl (5.4 kB)||File type Wheel||Python version 3.7||Upload date||Hashes View|
|Filename, size flake8-import-order-spoqa-1.5.0.tar.gz (5.2 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for flake8_import_order_spoqa-1.5.0-py2.py3-none-any.whl
Hashes for flake8-import-order-spoqa-1.5.0.tar.gz