# flake8-import-as-module
<p align="center">
<img alt="" src="https://raw.githubusercontent.com/joaopalmeiro/flake8-import-as-module/main/assets/logo_round.png" width="100" height="100" />
</p>
[![PyPI](https://img.shields.io/pypi/v/flake8-import-as-module.svg)](https://pypi.org/project/flake8-import-as-module/)
A [Flake8](https://flake8.pycqa.org/) plugin to check if specific packages are imported as modules.
## Installation
Via [Pipenv](https://pipenv.pypa.io/):
```bash
pipenv install --dev flake8 flake8-import-as-module
```
## Flake8 codes
| Package | Code | Description |
| --------------------------------------- | ----- | ------------------------------------------------------------------------------------ |
| [Altair](https://altair-viz.github.io/) | IM001 | `from altair import ...` is unconventional. `altair` should be imported as a module. |
| [pandas](https://pandas.pydata.org/) | IM002 | `from pandas import ...` is unconventional. `pandas` should be imported as a module. |
## References
- https://docs.python.org/3.7/tutorial/modules.html
- https://stackoverflow.com/a/49072655
- https://github.com/marcgibbons/flake8-datetime-import
- https://github.com/joaopalmeiro/flake8-import-conventions
- https://github.com/asottile/flake8-2020
## Development
```bash
poetry install --with dev
```
```bash
poetry shell
```
```bash
pytest tests/ -v
```
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)"
```
Raw data
{
"_id": null,
"home_page": "",
"name": "flake8-import-as-module",
"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/04/63/3eb3bdbe1f1f16ca3b81ac31bdd4d178572714112065522a3fdb6ed8d341/flake8_import_as_module-0.1.0.tar.gz",
"platform": null,
"description": "# flake8-import-as-module\n\n<p align=\"center\">\n <img alt=\"\" src=\"https://raw.githubusercontent.com/joaopalmeiro/flake8-import-as-module/main/assets/logo_round.png\" width=\"100\" height=\"100\" />\n</p>\n\n[![PyPI](https://img.shields.io/pypi/v/flake8-import-as-module.svg)](https://pypi.org/project/flake8-import-as-module/)\n\nA [Flake8](https://flake8.pycqa.org/) plugin to check if specific packages are imported as modules.\n\n## Installation\n\nVia [Pipenv](https://pipenv.pypa.io/):\n\n```bash\npipenv install --dev flake8 flake8-import-as-module\n```\n\n## Flake8 codes\n\n| Package | Code | Description |\n| --------------------------------------- | ----- | ------------------------------------------------------------------------------------ |\n| [Altair](https://altair-viz.github.io/) | IM001 | `from altair import ...` is unconventional. `altair` should be imported as a module. |\n| [pandas](https://pandas.pydata.org/) | IM002 | `from pandas import ...` is unconventional. `pandas` should be imported as a module. |\n\n## References\n\n- https://docs.python.org/3.7/tutorial/modules.html\n- https://stackoverflow.com/a/49072655\n- https://github.com/marcgibbons/flake8-datetime-import\n- https://github.com/joaopalmeiro/flake8-import-conventions\n- https://github.com/asottile/flake8-2020\n\n## Development\n\n```bash\npoetry install --with dev\n```\n\n```bash\npoetry shell\n```\n\n```bash\npytest tests/ -v\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",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Flake8 plugin to check if specific packages are imported as modules.",
"version": "0.1.0",
"split_keywords": [
"flake8",
"linter",
"qa",
"import",
"flake8 plugin",
"code quality"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "48befdee445206c6639c8ca41259726e67c39fe8f75f4fbb598b550306ac7fb1",
"md5": "7814e47b68cf5b8b433c2a741412e92d",
"sha256": "99a49785dfc0752608e64fb26df68fa58d18b05874c10daaa9df2f71f1b30d30"
},
"downloads": -1,
"filename": "flake8_import_as_module-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7814e47b68cf5b8b433c2a741412e92d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7,<4.0",
"size": 5411,
"upload_time": "2023-02-10T14:17:45",
"upload_time_iso_8601": "2023-02-10T14:17:45.230930Z",
"url": "https://files.pythonhosted.org/packages/48/be/fdee445206c6639c8ca41259726e67c39fe8f75f4fbb598b550306ac7fb1/flake8_import_as_module-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "04633eb3bdbe1f1f16ca3b81ac31bdd4d178572714112065522a3fdb6ed8d341",
"md5": "7aaf5b355d3c0fee9ac7af3c65c9344c",
"sha256": "9b2b0a19f0ba7b83b7b7cf184cdf95816478670e40439241557d1b7f8de8e007"
},
"downloads": -1,
"filename": "flake8_import_as_module-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "7aaf5b355d3c0fee9ac7af3c65c9344c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7,<4.0",
"size": 4629,
"upload_time": "2023-02-10T14:17:46",
"upload_time_iso_8601": "2023-02-10T14:17:46.777722Z",
"url": "https://files.pythonhosted.org/packages/04/63/3eb3bdbe1f1f16ca3b81ac31bdd4d178572714112065522a3fdb6ed8d341/flake8_import_as_module-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-02-10 14:17:46",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "flake8-import-as-module"
}