flake8-import-relative-two


Nameflake8-import-relative-two JSON
Version 0.2.0 PyPI version JSON
download
home_pagehttps://github.com/bartoszcholewa/flake8-import-relative-two
SummaryFlake8 plugin that checks for relative imports up to a maximum of level two
upload_time2023-10-14 15:37:49
maintainer
docs_urlNone
authorBartosz Cholewa
requires_python>=3.10,<4.0
licenseMIT
keywords flake8-plugin linting absolute-imports relative-imports
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # flake8-import-relative-two
============================
*Flake8 plugin that checks for relative imports up to a maximum of level two*

**Current Development Version:**

[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/bartoszcholewa/flake8-import-relative-two/ci_tests.yml?branch=main&logo=github)](https://github.com/bartoszcholewa/flake8-import-relative-two/actions)
[![codecov](https://codecov.io/gh/bartoszcholewa/flake8-import-relative-two/graph/badge.svg?token=RQ7LU60OYQ)](https://codecov.io/gh/bartoszcholewa/flake8-import-relative-two)

**Most Recent Stable Release:**

[![pypi](https://img.shields.io/pypi/v/flake8-import-relative-two.svg?logo=pypi)](https://pypi.org/project/flake8-import-relative-two)
![pypi](https://img.shields.io/pypi/pyversions/flake8-import-relative-two.svg?logo=python)

**Info:**

[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/bartoszcholewa/flake8-import-relative-two/blob/stable/LICENSE.txt)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Downloads](https://pepy.tech/badge/flake8-import-relative-two/month)](https://pepy.tech/project/flake8-import-relative-two)

----

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](https://github.com/bskinn/flake8-absolute-import) by Brian Skinn,
with help from [youtube video](https://www.youtube.com/watch?v=ot5Z4KQPBL8&t=926s&ab_channel=anthonywritescode)


`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:

```python
from foo import bar   # OK
from .foo import bar   # OK
from ..foo import bar   # OK
from ...foo import bar  # IRT1
```


Available on [PyPI](https://pypi.python.org/pypi/flake8-import-relative-two)(`pip install flake8-import-relative-two`).

`flake8` should automatically detect and load the plugin.

`flake8`>=6.0 is required.

Source on [GitHub](https://github.com/bartoszcholewa/flake8-import-relative-two)

Bug reports and feature requests are welcomed at the [Issues](https://github.com/bartoszcholewa/flake8-import-relative-two/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](http://creativecommons.org/licenses/by/4.0/) (CC-BY).

The `lake8-import-relative-two` codebase is released under the [MIT License](https://opensource.org/licenses/MIT). See
[LICENSE.txt](https://github.com/bartoszcholewa/flake8-import-relative-two/blob/main/LICENSE.txt) for
full license terms.
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/bartoszcholewa/flake8-import-relative-two",
    "name": "flake8-import-relative-two",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "flake8-plugin,linting,absolute-imports,relative-imports",
    "author": "Bartosz Cholewa",
    "author_email": "bbcholewa@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/00/32/6641d759df819d2602cd73ad73353b9560e7c8025886a261ae6e58897749/flake8_import_relative_two-0.2.0.tar.gz",
    "platform": null,
    "description": "# flake8-import-relative-two\n============================\n*Flake8 plugin that checks for relative imports up to a maximum of level two*\n\n**Current Development Version:**\n\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/bartoszcholewa/flake8-import-relative-two/ci_tests.yml?branch=main&logo=github)](https://github.com/bartoszcholewa/flake8-import-relative-two/actions)\n[![codecov](https://codecov.io/gh/bartoszcholewa/flake8-import-relative-two/graph/badge.svg?token=RQ7LU60OYQ)](https://codecov.io/gh/bartoszcholewa/flake8-import-relative-two)\n\n**Most Recent Stable Release:**\n\n[![pypi](https://img.shields.io/pypi/v/flake8-import-relative-two.svg?logo=pypi)](https://pypi.org/project/flake8-import-relative-two)\n![pypi](https://img.shields.io/pypi/pyversions/flake8-import-relative-two.svg?logo=python)\n\n**Info:**\n\n[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/bartoszcholewa/flake8-import-relative-two/blob/stable/LICENSE.txt)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Downloads](https://pepy.tech/badge/flake8-import-relative-two/month)](https://pepy.tech/project/flake8-import-relative-two)\n\n----\n\nPlugin created for linting relative imports up to a maximum of level two.\nOne 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.\n\nPlugin created based on [flake8-absolute-import](https://github.com/bskinn/flake8-absolute-import) by Brian Skinn,\nwith help from [youtube video](https://www.youtube.com/watch?v=ot5Z4KQPBL8&t=926s&ab_channel=anthonywritescode)\n\n\n`flake8-import-relative-two` uses a direct check of the AST for each\n`from ...x import y` statement to flag relative imports deeper than two levels.\n\nRelative imports raise the ``IRT1`` error code:\n\n```python\nfrom foo import bar   # OK\nfrom .foo import bar   # OK\nfrom ..foo import bar   # OK\nfrom ...foo import bar  # IRT1\n```\n\n\nAvailable on [PyPI](https://pypi.python.org/pypi/flake8-import-relative-two)(`pip install flake8-import-relative-two`).\n\n`flake8` should automatically detect and load the plugin.\n\n`flake8`>=6.0 is required.\n\nSource on [GitHub](https://github.com/bartoszcholewa/flake8-import-relative-two)\n\nBug reports and feature requests are welcomed at the [Issues](https://github.com/bartoszcholewa/flake8-import-relative-two/issues) page there.\n\nCopyright (c) Bartosz Cholewa 2023\n\nThe `lake8-import-relative-two` documentation (including docstrings and README) is licensed under a\n[Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/) (CC-BY).\n\nThe `lake8-import-relative-two` codebase is released under the [MIT License](https://opensource.org/licenses/MIT). See\n[LICENSE.txt](https://github.com/bartoszcholewa/flake8-import-relative-two/blob/main/LICENSE.txt) for\nfull license terms.",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Flake8 plugin that checks for relative imports up to a maximum of level two",
    "version": "0.2.0",
    "project_urls": {
        "Homepage": "https://github.com/bartoszcholewa/flake8-import-relative-two",
        "Repository": "https://github.com/bartoszcholewa/flake8-import-relative-two"
    },
    "split_keywords": [
        "flake8-plugin",
        "linting",
        "absolute-imports",
        "relative-imports"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1678c6efca92f1d6e5172ded583f6010cb1a0de93dba6376cbee412cc63560db",
                "md5": "706944a27c11bd4d36c0f690f6733eef",
                "sha256": "a6b7ed0f0b1e65ccb3f5bcdfe200ea2d7c4147a7d9e804b4e81cf94b74f25995"
            },
            "downloads": -1,
            "filename": "flake8_import_relative_two-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "706944a27c11bd4d36c0f690f6733eef",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 4916,
            "upload_time": "2023-10-14T15:37:45",
            "upload_time_iso_8601": "2023-10-14T15:37:45.069836Z",
            "url": "https://files.pythonhosted.org/packages/16/78/c6efca92f1d6e5172ded583f6010cb1a0de93dba6376cbee412cc63560db/flake8_import_relative_two-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "00326641d759df819d2602cd73ad73353b9560e7c8025886a261ae6e58897749",
                "md5": "031faaba3607cad6a7411751a652ecf9",
                "sha256": "19e41a58535628cb5147a4e965023eabf572b21b159a867057ecbaadc29dd797"
            },
            "downloads": -1,
            "filename": "flake8_import_relative_two-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "031faaba3607cad6a7411751a652ecf9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 3912,
            "upload_time": "2023-10-14T15:37:49",
            "upload_time_iso_8601": "2023-10-14T15:37:49.961165Z",
            "url": "https://files.pythonhosted.org/packages/00/32/6641d759df819d2602cd73ad73353b9560e7c8025886a261ae6e58897749/flake8_import_relative_two-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-14 15:37:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bartoszcholewa",
    "github_project": "flake8-import-relative-two",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "flake8-import-relative-two"
}
        
Elapsed time: 0.62721s