Check python import order.
Project description
CLI that check the ordering of imports. ordering follow a below rules.
Module order: __future__ , standard libraries, site-packages, local.
CONSTANT_NAMES must be the first.
ClassNames must be the second.
Rest must be in alphabetical order.
Requirements
Python 2.7.x or Python 3.3+
How to install
Via pip
$ pip install -U import-order
Or clone source code from repository and install it.
$ git clone https://github.com/spoqa/import-order.git
$ cd import_order
$ python setup.py install # or pip install .
How to use
Use import-order to check your python codes. If you want to check your local package named foo in root directory of package.
$ import-order foo
If you check your directory bar with local packages ( foo , baz ).
$ import-order foo ./bar baz
Or you can check your directory bar , file some.py without local packages (if --only-file is missing, it will raise ValueError ).
$ import-order --only-file ./bar some.py
For more information, look around help command.
$ import-order --help
When you ignore order on purpose, simply add # no import order at the import statement.
from foo.bar import b, a, c # no import order
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 import_order-0.0.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd27bd8581c1c049e9e7a95f036430106fb92e1b8b237a461a0e5043d694f20e |
|
MD5 | 65a4730ade743645ef2380fa5fbab907 |
|
BLAKE2b-256 | ba30a0ba7bfa50987562fb5ed3f882226c4d0e03661ea5cef0b1845d7c431401 |