flake8-absolute-import
raw JSON → 1.0.0.3 verified Fri May 01 auth: no python
A flake8 plugin that enforces absolute imports (no relative imports). Current version 1.0.0.3, requires Python >=3.10. Stable, with irregular releases.
pip install flake8-absolute-import Common errors
error ImportError: cannot import name '...' from 'flake8_absolute_import' ↓
cause Attempting to import a symbol that doesn't exist or using wrong import path.
fix
This plugin is automatically registered with flake8; you should not manually import it. Just run flake8.
error flake8 error: 'absolute-import' not found ↓
cause The plugin might not be installed or flake8 is not picking it up.
fix
Run 'pip install flake8-absolute-import'. Ensure flake8 is also installed. Verify with 'flake8 --version' to see the plugin listed.
Warnings
gotcha The plugin does not have any configuration options. It always enforces absolute imports with no way to exclude certain files or allow specific relative imports. ↓
fix If you need to allow relative imports in some cases, consider using a different plugin or disabling flake8-absolute-import for specific files via per-file-ignores in .flake8 config.
gotcha Python version requirement: Python >=3.10 only. Will not install on older Python versions. ↓
fix Ensure you are using Python 3.10 or newer.
Imports
- flake8_absolute_import wrong
import flake8_absolute_importcorrectfrom flake8_absolute_import import ...
Quickstart
# install: pip install flake8-absolute-import
# then run flake8 on your project:
# flake8 .
# The plugin will flag relative imports like:
# from . import module
# from ..parent import module