Skip to main content

flake8 plugin to require absolute imports

Project description

flake8 plugin to require absolute imports

Current Development Version:

GitHub Workflow Status https://codecov.io/gh/bskinn/flake8-absolute-import/branch/main/graph/badge.svg

Most Recent Stable Release:

https://img.shields.io/pypi/v/flake8-absolute-import.svg?logo=pypi https://img.shields.io/pypi/pyversions/flake8-absolute-import.svg?logo=python

Info:

https://img.shields.io/github/license/mashape/apistatus.svg https://img.shields.io/badge/code%20style-black-000000.svg

Don’t like relative imports?

Lint ‘em out!

flake8-absolute-import uses a simple check of the AST for each from x import y statement to flag relative imports. Specifically, it checks for a nonzero level attribute on each ImportFrom node.

Relative imports raise the ABS101 error code:

from foo import bar   # OK
from .foo import bar  # ABS101

Available on PyPI (pip install flake8-absolute-import). flake8 should automatically detect and load the plugin. flake8>=3.7 is required.

Source on GitHub. Bug reports and feature requests are welcomed at the Issues page there.

Copyright (c) Brian Skinn 2019-2021

License: The MIT License. See LICENSE.txt for full license terms.

Project details


Download files

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

Source Distributions

No source distribution files available for this release. See tutorial on generating distribution archives.

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page