Skip to main content

flake8-import-order-grok

A flake8-import-order ordering definition, defining Grok Learning's preferred import order style.

The import order enforced by this style is:

  1. __future__
  2. builtins
  3. Django
  4. Non-django third-party, grouped by package
  5. Application packages

All groups of imports require a line break between them, except between __future__ and builtins.

All imports must be alphabetical horizontally and vertically. Within an import unit, names must be constants first, followed by classes, followed by functions (i.e. CAPITAL_CASE, CamelCase, underscore_case).

The names of the application packages can be configured via the application-import-names setting in flake8.

For example, if application-import-names is set to my_project, this import ordering enforces the following ordering:

# coding: utf-8
from __future__ import absolute_import, print_function, unicode_literals  # 1. `__future__`
import io  # 2. Builtins.
import logging
import os
import tarfile

from django.conf import settings  # 3. Django.
from django.utils.http import urlencode

from dns.exception import DNSException, Timeout  # 4. Non-Django third-party packages, each one separated by a blank line.
from dns.resolver import NXDOMAIN, NoAnswer, Resolver

import requests

import ujson

from my_project.core.enums import Enum  # 5. Application packages.
from my_project.utils.download import DOWNLOAD_TIMEOUT, InvalidURLException, download_content_url

Usage

Install the flake8-import-order-grok package using pip, then tell flake8 to use this import order style using the --import-order-style=grok command-line option, or by setting it in setup.cfg. The names of your application package(s) can be set by the application-import-names setting:

[flake8]
import-order-style = grok
application-import-names = my_package1, my_package2

Release files for flake8-import-order-grok 0.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flake8-import-order-grok 0.3.3
File Size Uploaded
flake8-import-order-grok-0.3.3.tar.gz 3.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flake8-import-order-grok 0.3.3
File Interpreter ABI Platform
flake8_import_order_grok-0.3.3-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 8.3 kB

Release files / flake8-import-order-grok-0.3.3.tar.gz

Download URL flake8-import-order-grok-0.3.3.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
02717266073e8a81f03174b7bd9eb13c52089468ec420d6bf1a569daec99de35
BLAKE2b-256 checksum
How to use checksums
a836145393f4dd1aa14d6ad0f1e6562d03e3cf1f406ebcf258962105601c4f08
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.5

Release files / flake8_import_order_grok-0.3.3-py2.py3-none-any.whl

Download URL flake8_import_order_grok-0.3.3-py2.py3-none-any.whl
Size 5.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
532975655e7f88dabf182656b5d963ee643cb85a8d0b15a238c744a0e6a7f391
BLAKE2b-256 checksum
How to use checksums
46ef22054e108f1114aa52c43e3b3439466d5e4f5501b2a3c385e25b54fba1a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.5

Release history Release notifications | RSS feed

This release

0.3.3 This release

2 release files

0.3.1

2 release files

0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page