https://github.com/joaopalmeiro/flake8-import-as-module
A Flake8 plugin to check if specific packages are imported as modules.
https://github.com/joaopalmeiro/flake8-import-as-module
flake8 flake8-plugin
Last synced: 5 months ago
JSON representation
A Flake8 plugin to check if specific packages are imported as modules.
- Host: GitHub
- URL: https://github.com/joaopalmeiro/flake8-import-as-module
- Owner: joaopalmeiro
- License: mit
- Created: 2023-02-08T20:00:49.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-10T14:17:01.000Z (about 3 years ago)
- Last Synced: 2025-03-26T05:26:33.864Z (12 months ago)
- Topics: flake8, flake8-plugin
- Language: Python
- Homepage: https://pypi.org/project/flake8-import-as-module/
- Size: 1.07 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# flake8-import-as-module
[](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)"
```