In pyproject.toml, we have "__init__.py" = ["I"] under tool.ruff.lint.per-file-ignores because package init files sometimes rely on import order. But this also catches subpackages that are implemented in their __init__.py file. In those cases, we do want to sort imports. So I suggest removing the blanked ignore and instead ignore specific files that we know rely on import order.
Alternatively, and maybe cleaner, we would not allow implementing packages in __init__.py and restrict those files to gathering symbols from other modules. But I don't think there is a lint for that. So it is hard to enforce.
In
pyproject.toml
, we have"__init__.py" = ["I"]
undertool.ruff.lint.per-file-ignores
because package init files sometimes rely on import order. But this also catches subpackages that are implemented in their__init__.py
file. In those cases, we do want to sort imports. So I suggest removing the blanked ignore and instead ignore specific files that we know rely on import order.Alternatively, and maybe cleaner, we would not allow implementing packages in
__init__.py
and restrict those files to gathering symbols from other modules. But I don't think there is a lint for that. So it is hard to enforce.