--- id: flake8-tidy-imports version: "4.12.0" license: MIT license_treatment: permissive maintenance: active --- # flake8-tidy-imports — A flake8 plugin that helps you write tidier imports. License: permissive · Maintenance: active · Downloads: 461.5K/mo ## What it is and what it does flake8-tidy-imports is a flake8 plugin that enforces import hygiene by detecting three categories of import issues: unnecessary aliases (I250), banned imports (I251), and relative imports (I252). It integrates directly into flake8's linting workflow and reports violations with configurable messages. The plugin is configured via flake8's standard config files and allows you to define which imports should be banned, whether relative imports are allowed, and what messages to show when violations occur. The plugin supports wildcard patterns in banned-modules, a special {python2to3} directive to ban Python 2 modules with suggested replacements, and fine-grained control over relative imports. It has been actively maintained since 2016 and is classified as Production/Stable with support for Python 3.9 to 3.14. Use it for: - Enforce a project-wide ban on deprecated modules and suggest modern replacements during code review. - Prevent accidental use of relative imports in a codebase that requires absolute imports for clarity. - Automatically flag unnecessary import aliases during linting to keep imports clean. - Configure wildcard bans on entire module hierarchies to guide developers away from old code. - Integrate import style enforcement into CI/CD pipelines via flake8 without additional tools. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. A flake8 plugin that detects and reports unnecessary import aliases, banned imports, and relative imports according to configurable rules. Yes. The plugin is actively maintained, has no known vulnerabilities, carries a permissive MIT license, and installs with minimal friction (one dependency). It solves a real problem—enforcing import discipline—and integrates seamlessly into existing flake8 workflows. Recommended for any project using flake8 that wants to enforce import policies. ## Install pip install flake8-tidy-imports uv add flake8-tidy-imports poetry add flake8-tidy-imports ## Installing flake8-tidy-imports Before you install: Low friction: pure Python wheel with only flake8 as a runtime dependency. Actively maintained with last commit 2026-08-13 and latest release 2025-09-08. Supports Python 3.9 to 3.14. License in practice: MIT license (permissive) places no restrictions on use, modification, or distribution in proprietary or open-source projects. Quickstart: pip install flake8-tidy-imports # In setup.cfg or .flake8: [flake8] banned-modules = mock = Use unittest.mock. # Then run flake8 as normal: flake8 your_code.py Requires Python 3.9 or later. If you define flake8's `select` setting, you must add the `I25` prefix to activate the plugin's rules. Verify before relying: - Whether the suggested rewrites for I250 (unnecessary aliases) are always syntactically correct in all edge cases. - Performance impact when checking large codebases with many banned-modules entries or wildcard patterns. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 461.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags flake8 import linting, detect unnecessary import aliases, ban imports by configuration, relative import checker, import style enforcement, flake8 plugin for imports, tidy import rules, linting, import-hygiene, code-quality [View on SkillFed](https://skillfed.io/packages/flake8-tidy-imports) · [View on PyPI](https://pypi.org/project/flake8-tidy-imports/)