Skip to main content

Check python import order.

Project description

Wheel Status Supported Python versions pypi packages travis-ci status

CLI that check the ordering of imports. ordering follow a below rules.

  1. Module order: __future__ , standard libraries, site-packages, local.

  2. CONSTANT_NAMES must be the first.

  3. ClassNames must be the second.

  4. 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

Author and license

import-order is maintained by Spoqa, and licensed under GPL3 or later.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

import-order-0.0.11.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

import_order-0.0.11-py2.py3-none-any.whl (11.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file import-order-0.0.11.tar.gz.

File metadata

File hashes

Hashes for import-order-0.0.11.tar.gz
Algorithm Hash digest
SHA256 52c8155d6335f393bccff842a6853849fc644c1952a31296f5ea0d179bb55ad4
MD5 dc47d529dc1c712db1d067ad3eb36ffb
BLAKE2b-256 0f11d20bef3000425703ebc4102193c73d13fb64c302eef9c78b8630be582be8

See more details on using hashes here.

Provenance

File details

Details for the file import_order-0.0.11-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for import_order-0.0.11-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b2a09fa9b2c13bf4d8a22865bcac30762995c2d97797a89713074072b655dc27
MD5 372c53a0c56c620ba078b83e0b7a4c22
BLAKE2b-256 3048f9dfab8215095d7bd3ff423dd5eeaba150784133e6ac1fcf2bf8e531eb60

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page