Giter Site home page Giter Site logo

flake8-absolute-import's Introduction

flake8-absolute-import

flake8 plugin to require absolute imports

Current Development Version:

image

Most Recent Stable Release:

image

image

Info:

image

image

image


Don't like relative imports?

Lint 'em out!

flake8-absolute-import uses a direct 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>=5.0 is required.

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

Copyright (c) Brian Skinn 2019-2023

The flake8-absolute-import documentation (including docstrings and README) is licensed under a Creative Commons Attribution 4.0 International License (CC-BY). The flake8-absolute-import codebase is released under the MIT License. See LICENSE.txt for full license terms.

flake8-absolute-import's People

Contributors

bskinn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

flake8-absolute-import's Issues

Support flake8 4.0.0

flake8 4.0.0 was released earlier today (2021-10-11), and I noticed this is one of several plugins not supporting 4.0.0. This should be updated.

Discovered whilst updating pre-commit hooks:

stderr:
      DEPRECATION: A future pip version will change local packages to be built in-place without first copyin
g to a temporary directory. We recommend you use --use-feature=in-tree-build to test your packages with this
 new behavior before it becomes the default.
       pip 21.3 will remove support for this functionality. You can find discussion regarding this at https:
//github.com/pypa/pip/issues/7555.
    ERROR: Cannot install flake8 4.0.0 (from /home/wande/.cache/pre-commit/repo1s37k6t_), flake8-absolute-im
port==1.0, flake8-annotations==1.0.0, flake8-annotations==1.1.0, flake8-annotations==1.1.1, flake8-annotatio
ns==1.1.2, flake8-annotations==1.1.3, flake8-annotations==1.2.0, flake8-annotations==2.0.0, flake8-annotatio
ns==2.0.1, flake8-annotations==2.1.0, flake8-annotations==2.2.1, flake8-annotations==2.3.0, flake8-annotatio
ns==2.4.0, flake8-annotations==2.4.1, flake8-annotations==2.5.0, flake8-annotations==2.6.0, flake8-annotatio
ns==2.6.1 and flake8-annotations==2.6.2 because these package versions have conflicting dependencies.
    ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting
-dependencies

Subdivide detection into module/class/function/method scopes

For simplified per-scope filtering of import reporting.

Probably best to keep both the 'report all' mode and add the 'per scope' mode atop it, as an option.

Would have to figure out sniffing the flake8 options, and the logic of accurate scope determinations for each type.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.