Skip to content

Removal of mandatory isort dependency for import position check #10637

@Pierre-Sassoulas

Description

@Pierre-Sassoulas

Current problem

Currently, Pylint relies on isort as a mandatory dependency to handle wrong-import-position and wrong-import-order. However, maintaining and fixing isort-related issues consumes significant time and may not provide long-term value, given that:

  • importing isort takes a not insignificant part of pylint's startup time
  • if you use isort or ruff, pylint bring no value as it's autofixxed, and you simply disable those two checks
  • it adds an additional layer of complexity with two or three noqas to handle (isort/pylint/ruff), especially considering that each of those noqas have scopes, and that by nature the scope of a noqa is blurry as disabling on the scope of a line will have implications on other lines because the checks are about ordering and other tools because ruff interact with isort already (see discussion)

Desired solution

There's two possible directions I can think of right now:

  • Drop isort and the wrong-import-position checker entirely, simplifying dependencies and improving startup performance.

  • Take a decision about how to handle the noqas. Add optional support for Ruff, using Ruff and isort as optional dependencies. This would allow future extensibility to autofix with ruff once the wrong-import-position proof of concept is validated (but we could still get this benefit without bothering with import order ourselves), so the main benefit is for users who use wrong-import-position and wrong-import-order.

Either approach implies a meaningful design change and likely belongs in Pylint 5.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Enhancement ✨Improvement to a componentNeeds decision 🔒Needs a decision before implemention or rejectionNeeds design proposal 🔒This is a huge feature, some discussion should happen before a PR is proposed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions