Skip to main content

flake8-import-order-ruler501

A flake8-import-order ordering definition, defining ruler501's preferred import order style. Originally based on flake8-import-order-grok

The import order enforced by this style is:

  1. __future__
  2. builtins
  3. third-party, grouped separately by package
  4. Application packages by package
  5. Relative imports

All groups of imports require a line break between them, except packages within your application.

All imports must be alphabetical horizontally and vertically. from import groups are on separate lines sorted by 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.1 django
from django.utils.http import urlencode

from dns.exception import DNSException, Timeout  # 3.2
from dns.resolver import NXDOMAIN
from dns.resolver import NoAnswer, Resolver

import requests # 3.3 

import ujson #3.4

from my_project.views import MainView  # 4. Application packages.
from my_project.core.enums import Enum
from my_project.utils.download import DOWNLOAD_TIMEOUT
from my_project.utils.download import InvalidURLException
from my_project.utils.download import download_content_url

from .models import Article

Usage

Install the flake8-import-order-ruler501 package using pip, then tell flake8 to use this import order style using the --import-order-style=ruler501 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 = ruler501
application-import-names = my_package1, my_package2

Metadata

Release files for flake8-import-order-ruler501 0.18.1.2

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-ruler501 0.18.1.2
File Size Uploaded Provenance Actions
flake8-import-order-ruler501-0.18.1.2.tar.gz 3.5 kB Without provenance Details for flake8-import-order-ruler501-0.18.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for flake8-import-order-ruler501 0.18.1.2
File Interpreter ABI Platform Actions
flake8_import_order_ruler501-0.18.1.2-py2.py3-none-any.whl Python 3, Python 2 none any Details for flake8_import_order_ruler501-0.18.1.2-py2.py3-none-any.whl

Total release size: 8.9 kB

Release files / flake8-import-order-ruler501-0.18.1.2.tar.gz

Download URL flake8-import-order-ruler501-0.18.1.2.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0d5fce27fc96b4ee1b34507b08f0728f148e15690144cff65fabb1811d97f1a6
BLAKE2b-256 checksum
How to use checksums
cb7a669ae609887f42bfaeaaf605360e1059c7737e602163c280ea14674e3a98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.6.6

Release files / flake8_import_order_ruler501-0.18.1.2-py2.py3-none-any.whl

Download URL flake8_import_order_ruler501-0.18.1.2-py2.py3-none-any.whl
Size 5.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
76661dd902a84b5af88f7b0b98f4eecd897778e847ebb06bc9c3fcd067642b64
BLAKE2b-256 checksum
How to use checksums
191d5cec3abf99e132bb826688605736fa7b6ad110f35a9b9a0c416b1a1c5f6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.6.6

Security for flake8-import-order-ruler501 0.18.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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