Flake8 plugin that checks for relative imports up to a maximum of level two
Project description
flake8-import-relative-two
============================ Flake8 plugin that checks for relative imports up to a maximum of level two
Current Development Version:
Most Recent Stable Release:
Info:
Plugin created for linting relative imports up to a maximum of level two. One of private projects I work on has a rule that forbids relative imports deeper than two levels and need to be converted to absolute imports.
Plugin created based on flake8-absolute-import by Brian Skinn, with help from youtube video
flake8-import-relative-two
uses a direct check of the AST for each
from ...x import y
statement to flag relative imports deeper than two levels.
Relative imports raise the IRT1
error code:
from foo import bar # OK
from .foo import bar # OK
from ..foo import bar # OK
from ...foo import bar # IRT1
Available on PyPI(pip install flake8-import-relative-two
).
flake8
should automatically detect and load the plugin.
flake8
>=6.0 is required.
Source on GitHub
Bug reports and feature requests are welcomed at the Issues page there.
Copyright (c) Bartosz Cholewa 2023
The lake8-import-relative-two
documentation (including docstrings and README) is licensed under a
Creative Commons Attribution 4.0 International License (CC-BY).
The lake8-import-relative-two
codebase is released under the MIT License. See
LICENSE.txt for
full license terms.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file flake8_import_relative_two-0.2.0.tar.gz
.
File metadata
- Download URL: flake8_import_relative_two-0.2.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.6 Linux/5.15.90.1-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19e41a58535628cb5147a4e965023eabf572b21b159a867057ecbaadc29dd797 |
|
MD5 | 031faaba3607cad6a7411751a652ecf9 |
|
BLAKE2b-256 | 00326641d759df819d2602cd73ad73353b9560e7c8025886a261ae6e58897749 |
File details
Details for the file flake8_import_relative_two-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: flake8_import_relative_two-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.6 Linux/5.15.90.1-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6b7ed0f0b1e65ccb3f5bcdfe200ea2d7c4147a7d9e804b4e81cf94b74f25995 |
|
MD5 | 706944a27c11bd4d36c0f690f6733eef |
|
BLAKE2b-256 | 1678c6efca92f1d6e5172ded583f6010cb1a0de93dba6376cbee412cc63560db |