Metadata-Version: 2.1
Name: flake8-import-as-module
Version: 0.1.0
Summary: A Flake8 plugin to check if specific packages are imported as modules.
License: MIT
Keywords: flake8,linter,qa,import,flake8 plugin,code quality
Author: João Palmeiro
Author-email: joaopalmeiro@proton.me
Requires-Python: >=3.7,<4.0
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Framework :: Flake8
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Typing :: Typed
Requires-Dist: flake8 (>=5)
Description-Content-Type: text/markdown

# 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)"
```

