Problem
The project currently includes multiple tools that check for unused imports:
- importchecker (dev group)
- unimport (lint group)
- pyflakes (via flake8 - lint group)
- ruff with F401 rule (lint group)
Tools 1 and 2 are redundant because both pyflakes and ruff already detect unused imports via the F401 rule, which is already enabled in our linting pipeline.
Current Configuration
pyproject.toml
dev = [
"importchecker",
# ...
]
lint = [
"flake8>=7.3.0", # includes pyflakes F401
"ruff>=0.13.0", # includes F401 by default
"unimport>=1.2.1", # redundant
# ...
]
Makefile
importchecker:
uv run --group=dev importchecker .
unimport:
uv run --group=lint unimport --check --diff $(TARGET)
Recommendation
Remove both importchecker and unimport from:
- pyproject.toml dependency groups
- Makefile targets
- .pre-commit-config.yaml (if present)
- GitHub workflows (.github/workflows/*.yml)
- Any CI/CD pipelines that reference them
- Documentation mentioning these tools
Benefits
- Reduced dependencies: Two fewer packages to install and maintain
- Faster builds: Fewer tools to run during linting
- Simpler configuration: One canonical source of truth (ruff/pyflakes)
- Less confusion: Developers won't wonder which tool to use
- Better performance: Ruff is significantly faster than unimport
- Cleaner CI: Fewer pipeline steps to maintain
Verification
Ruff already checks for unused imports:
# F401 is enabled by default in ruff
ruff check mcpgateway/ --select=F401
Flake8 also includes this via pyflakes:
# F401 is part of pyflakes, included in flake8
flake8 mcpgateway/ --select=F401
Implementation Checklist
Search Commands
To find all references:
# Find all references to these tools
grep -r "importchecker" .
grep -r "unimport" . --include="*.yml" --include="*.yaml" --include="*.md"
Related
This is part of the broader effort to consolidate linting tools and reduce redundancy in the development toolchain.
Problem
The project currently includes multiple tools that check for unused imports:
Tools 1 and 2 are redundant because both pyflakes and ruff already detect unused imports via the F401 rule, which is already enabled in our linting pipeline.
Current Configuration
pyproject.toml
Makefile
Recommendation
Remove both importchecker and unimport from:
Benefits
Verification
Ruff already checks for unused imports:
# F401 is enabled by default in ruff ruff check mcpgateway/ --select=F401Flake8 also includes this via pyflakes:
# F401 is part of pyflakes, included in flake8 flake8 mcpgateway/ --select=F401Implementation Checklist
Remove from pyproject.toml:
"importchecker"from dev group"unimport>=1.2.1"from lint groupRemove from Makefile:
importcheckertargetunimporttargetlint,lint-all)Check and remove from .pre-commit-config.yaml:
Check and remove from GitHub workflows:
.github/workflows/*.ymlimportcheckerandunimportreferencesUpdate documentation:
Update uv.lock:
uv lockafter removing dependenciesSearch Commands
To find all references:
Related
This is part of the broader effort to consolidate linting tools and reduce redundancy in the development toolchain.