flake8-import-order-spoqa
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 # NoHowever, there are few exceptions like typing module. They can be imported in both ways:
import typing from typing import Optional # `from ... import ...` must be latterAll other than standard libraries should be imported using from ... import ... statement:
from flask import Flask # Yes import flask # NoDeeper 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 laterImported 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.5.0
Released on August 31, 2018.
The dataclasses module, like typing, now can be imported without a qualifier (e.g., from dataclasses import ...).
Version 1.4.1
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.
Version 1.4.0
Released on May 22, 2018.
Python 3.3 became no more supported.
Version 1.3.0
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]
Version 1.2.0
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.)
Version 1.1.0
Released on October 31, 2017.
Older versions than flake8-import-order 0.14.2 are now unsupported.
Version 1.0.2
Released on October 31, 2017.
Fixed incompatibility with flake8-import-order 0.14.1 or higher.
Version 1.0.1
Released on July 15, 2017.
Fixed a bug that wrong order of names (e.g. from ... import second, first) had been not warned.
Version 1.0.0
Initial release. Released on February 12, 2017.
Release files for flake8-import-order-spoqa 1.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| flake8-import-order-spoqa-1.5.0.tar.gz | 5.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flake8_import_order_spoqa-1.5.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 10.6 kB
Release files / flake8-import-order-spoqa-1.5.0.tar.gz
| Download URL | flake8-import-order-spoqa-1.5.0.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e18f4e91c58754a8153424de7f4a2973a042966c308100f17933ee406fbf65fd
|
|
BLAKE2b-256 checksum How to use checksums |
2bb379c6e01be81bf9d656842fd48c949111f3b9de4bd7beccb9df606e3e3d4a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.7
|
Release files / flake8_import_order_spoqa-1.5.0-py2.py3-none-any.whl
| Download URL | flake8_import_order_spoqa-1.5.0-py2.py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
69ea2bc8c0facaaffe4003139060d307df85d8a1e48eecb910288bcedbe752d2
|
|
BLAKE2b-256 checksum How to use checksums |
f2b7bdab9e7e59f54ead35b369748bbda0b5f27bcc19569c176a9e7bb114190b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.7
|