# flake8-import-conventions
<p align="center">
<img alt="" src="https://raw.githubusercontent.com/joaopalmeiro/flake8-import-conventions/main/assets/logo_round.png" width="100" height="100" />
</p>
[![PyPI](https://img.shields.io/pypi/v/flake8-import-conventions.svg)](https://pypi.org/project/flake8-import-conventions/)
An opinionated plugin for Flake8 on how certain packages should be imported or aliased.
It is based on the [`pandas-vet`](https://github.com/deppen8/pandas-vet) and [`flake8-2020`](https://github.com/asottile/flake8-2020) plugins.
## Installation
Via [Pipenv](https://pipenv.pypa.io/):
```bash
pipenv install --dev flake8 flake8-import-conventions
```
## Flake8 codes
| Package | Code | Description |
| ------------------------------------------- | ----- | ------------------------------------------------------------------------------ |
| [Altair](https://altair-viz.github.io/) | IC001 | altair should be imported as `import altair as alt` |
| [GeoPandas](https://geopandas.org/) | IC002 | geopandas should be imported as `import geopandas` |
| [Matplotlib](https://matplotlib.org/) | IC003 | matplotlib.pyplot should be imported as `import matplotlib.pyplot as plt` |
| [NetworkX](https://networkx.org/) | IC004 | networkx should be imported as `import networkx as nx` |
| [NumPy](https://numpy.org/) | IC005 | numpy should be imported as `import numpy as np` |
| [pandas](https://pandas.pydata.org/) | IC006 | pandas should be imported as `import pandas as pd` |
| [Plotly](https://plotly.com/python/) | IC007 | plotly.express should be imported as `import plotly.express as px` |
| [Plotly](https://plotly.com/python/) | IC008 | plotly.graph_objects should be imported as `import plotly.graph_objects as go` |
| [seaborn](https://seaborn.pydata.org/) | IC009 | seaborn should be imported as `import seaborn as sns` |
| [statsmodels](https://www.statsmodels.org/) | IC010 | statsmodels.api should be imported as `import statsmodels.api as sm` |
## Development
```bash
poetry install --with dev
```
```bash
poetry shell
```
Open the `manual_test.py` file in VS Code to see the error messages.
```bash
pytest tests/ -v
```
or (to see `print()`s)
```bash
pytest tests/ -v -s
```
Copy the output of the following script and paste it in the [Flake8 codes](#flake8-codes) section:
```bash
python gen_table.py
```
If changes are not reflected in VS Code after changing something in the package, close it and open it again.
## Deployment
```bash
poetry check
```
```bash
poetry version minor
```
or
```bash
poetry version patch
```
Commit the change in the `pyproject.toml` file.
```bash
git tag
```
```bash
git tag "v$(poetry version --short)"
```
```bash
git push origin "v$(poetry version --short)"
```
## References
- Anthony Sottile's "[a flake8 plugin from scratch (intermediate) anthony explains #025](https://youtu.be/ot5Z4KQPBL8)" tutorial.
- [flake8-pie](https://github.com/sbdchd/flake8-pie).
- [wemake-python-styleguide](https://github.com/wemake-services/wemake-python-styleguide).
Raw data
{
"_id": null,
"home_page": "",
"name": "flake8-import-conventions",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7,<4.0",
"maintainer_email": "",
"keywords": "flake8,linter,qa,import,flake8-plugin,code quality",
"author": "Jo\u00e3o Palmeiro",
"author_email": "joaopalmeiro@proton.me",
"download_url": "https://files.pythonhosted.org/packages/4b/2a/94072dab358027f3ce2a9eee278624124da50be7d252d44b418f7aea2b27/flake8_import_conventions-0.1.0.tar.gz",
"platform": null,
"description": "# flake8-import-conventions\n\n<p align=\"center\">\n <img alt=\"\" src=\"https://raw.githubusercontent.com/joaopalmeiro/flake8-import-conventions/main/assets/logo_round.png\" width=\"100\" height=\"100\" />\n</p>\n\n[![PyPI](https://img.shields.io/pypi/v/flake8-import-conventions.svg)](https://pypi.org/project/flake8-import-conventions/)\n\nAn opinionated plugin for Flake8 on how certain packages should be imported or aliased.\n\nIt is based on the [`pandas-vet`](https://github.com/deppen8/pandas-vet) and [`flake8-2020`](https://github.com/asottile/flake8-2020) plugins.\n\n## Installation\n\nVia [Pipenv](https://pipenv.pypa.io/):\n\n```bash\npipenv install --dev flake8 flake8-import-conventions\n```\n\n## Flake8 codes\n\n| Package | Code | Description |\n| ------------------------------------------- | ----- | ------------------------------------------------------------------------------ |\n| [Altair](https://altair-viz.github.io/) | IC001 | altair should be imported as `import altair as alt` |\n| [GeoPandas](https://geopandas.org/) | IC002 | geopandas should be imported as `import geopandas` |\n| [Matplotlib](https://matplotlib.org/) | IC003 | matplotlib.pyplot should be imported as `import matplotlib.pyplot as plt` |\n| [NetworkX](https://networkx.org/) | IC004 | networkx should be imported as `import networkx as nx` |\n| [NumPy](https://numpy.org/) | IC005 | numpy should be imported as `import numpy as np` |\n| [pandas](https://pandas.pydata.org/) | IC006 | pandas should be imported as `import pandas as pd` |\n| [Plotly](https://plotly.com/python/) | IC007 | plotly.express should be imported as `import plotly.express as px` |\n| [Plotly](https://plotly.com/python/) | IC008 | plotly.graph_objects should be imported as `import plotly.graph_objects as go` |\n| [seaborn](https://seaborn.pydata.org/) | IC009 | seaborn should be imported as `import seaborn as sns` |\n| [statsmodels](https://www.statsmodels.org/) | IC010 | statsmodels.api should be imported as `import statsmodels.api as sm` |\n\n## Development\n\n```bash\npoetry install --with dev\n```\n\n```bash\npoetry shell\n```\n\nOpen the `manual_test.py` file in VS Code to see the error messages.\n\n```bash\npytest tests/ -v\n```\n\nor (to see `print()`s)\n\n```bash\npytest tests/ -v -s\n```\n\nCopy the output of the following script and paste it in the [Flake8 codes](#flake8-codes) section:\n\n```bash\npython gen_table.py\n```\n\nIf changes are not reflected in VS Code after changing something in the package, close it and open it again.\n\n## Deployment\n\n```bash\npoetry check\n```\n\n```bash\npoetry version minor\n```\n\nor\n\n```bash\npoetry version patch\n```\n\nCommit the change in the `pyproject.toml` file.\n\n```bash\ngit tag\n```\n\n```bash\ngit tag \"v$(poetry version --short)\"\n```\n\n```bash\ngit push origin \"v$(poetry version --short)\"\n```\n\n## References\n\n- Anthony Sottile's \"[a flake8 plugin from scratch (intermediate) anthony explains #025](https://youtu.be/ot5Z4KQPBL8)\" tutorial.\n- [flake8-pie](https://github.com/sbdchd/flake8-pie).\n- [wemake-python-styleguide](https://github.com/wemake-services/wemake-python-styleguide).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "An opinionated plugin for Flake8 on how certain packages should be imported or aliased.",
"version": "0.1.0",
"split_keywords": [
"flake8",
"linter",
"qa",
"import",
"flake8-plugin",
"code quality"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0abc7770ca645bc9739019c2d51aaa9134f974ca623e4c8474f42db6eaf608dd",
"md5": "3a4a207ef08ec9333c9608a37f6cadef",
"sha256": "d0a32cbdb78239a4976aef5d3ac958f25a2b6c155760060d40a8bbebe481a03b"
},
"downloads": -1,
"filename": "flake8_import_conventions-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3a4a207ef08ec9333c9608a37f6cadef",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7,<4.0",
"size": 6106,
"upload_time": "2023-02-08T08:59:54",
"upload_time_iso_8601": "2023-02-08T08:59:54.608033Z",
"url": "https://files.pythonhosted.org/packages/0a/bc/7770ca645bc9739019c2d51aaa9134f974ca623e4c8474f42db6eaf608dd/flake8_import_conventions-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4b2a94072dab358027f3ce2a9eee278624124da50be7d252d44b418f7aea2b27",
"md5": "e694d2daa8c2b659817f38d5c61a94a6",
"sha256": "0710db3a77de023c9a40b4483a9a259a1fdc3d09187892799614bf0f425df779"
},
"downloads": -1,
"filename": "flake8_import_conventions-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "e694d2daa8c2b659817f38d5c61a94a6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7,<4.0",
"size": 5053,
"upload_time": "2023-02-08T08:59:55",
"upload_time_iso_8601": "2023-02-08T08:59:55.620547Z",
"url": "https://files.pythonhosted.org/packages/4b/2a/94072dab358027f3ce2a9eee278624124da50be7d252d44b418f7aea2b27/flake8_import_conventions-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-02-08 08:59:55",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "flake8-import-conventions"
}