Opening a new thread as PEP 810: Explicit lazy imports was closed. Moderators please move this to wherever is most appropriate, I couldn’t make up my mind…
Thanks to some hard work by the community isort and ruff now support sorting lazy imports, just in time for the first beta release of Python 3.15.
For ruff you will need version 0.15.6, for isort you’ll need version 9.0.0a2.
Obviously, I can’t speak for the folks over at ruff but I think we welcome any feedback on this, especially since the SC approval explicitly asked for “the linters and auto-formatters to decide the details”. We’ll need some input from the community to get those details right though ![]()
You can reach both projects at their respective repositories and issues.
Isort’s issue: Support explicit lazy imports in Python 3.15 (PEP 810) · Issue #2462 · PyCQA/isort · GitHub
Ruff’s issue: Support and lints for `lazy` imports in Python 3.15+ · Issue #21305 · astral-sh/ruff · GitHub
I am not aware of any other widely used import sorting tools, but of course if there are any feel free to reach out. Within the isort project we are committed to (at least try to) create a single standard for sorting these imports within the ecosystem.