Skip to content

[CHORE] Remove redundant import checkers: importchecker and unimport #1290

@jonpspri

Description

@jonpspri

Problem

The project currently includes multiple tools that check for unused imports:

  1. importchecker (dev group)
  2. unimport (lint group)
  3. pyflakes (via flake8 - lint group)
  4. 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:

  1. pyproject.toml dependency groups
  2. Makefile targets
  3. .pre-commit-config.yaml (if present)
  4. GitHub workflows (.github/workflows/*.yml)
  5. Any CI/CD pipelines that reference them
  6. Documentation mentioning these tools

Benefits

  1. Reduced dependencies: Two fewer packages to install and maintain
  2. Faster builds: Fewer tools to run during linting
  3. Simpler configuration: One canonical source of truth (ruff/pyflakes)
  4. Less confusion: Developers won't wonder which tool to use
  5. Better performance: Ruff is significantly faster than unimport
  6. 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

  • Remove from pyproject.toml:

    • "importchecker" from dev group
    • "unimport>=1.2.1" from lint group
  • Remove from Makefile:

    • importchecker target
    • unimport target
    • Any references in composite targets (e.g., lint, lint-all)
  • Check and remove from .pre-commit-config.yaml:

    • Any hooks using unimport
    • Any hooks using importchecker
  • Check and remove from GitHub workflows:

    • .github/workflows/*.yml
    • Search for importchecker and unimport references
  • Update documentation:

    • Remove mentions from README.md
    • Remove mentions from CONTRIBUTING.md
    • Remove mentions from docs/
  • Update uv.lock:

    • Run uv lock after removing dependencies

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    choreLinting, formatting, dependency hygiene, or project maintenance chorescicdIssue with CI/CD process (GitHub Actions, scaffolding)

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions