From 790b63f1096cdc8730a044d287c83ee251d8cbc5 Mon Sep 17 00:00:00 2001 From: MUHAMED FAZAL PS Date: Mon, 29 Jun 2026 18:36:36 +0530 Subject: [PATCH] fix: sort_reexports should respect isort: skip comment When sort_reexports is enabled, __all__ assignments with # isort: skip were still being sorted. Added check for isort: skip comment before processing re-exports. Signed-off-by: Muhamed Fazal PS --- isort/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/isort/core.py b/isort/core.py index 46bd77f1..a8e33738 100644 --- a/isort/core.py +++ b/isort/core.py @@ -244,7 +244,7 @@ def process( code_sorting = stripped_line.split("isort: ")[1].strip() code_sorting_indent = line[: -len(line.lstrip())] not_imports = True - elif config.sort_reexports and stripped_line.startswith("__all__"): + elif config.sort_reexports and stripped_line.startswith("__all__") and "isort: skip" not in stripped_line: _, rhs = stripped_line.split("=") code_sorting = LITERAL_TYPE_MAPPING.get(rhs.lstrip()[0], "tuple") code_sorting_indent = line[: -len(line.lstrip())]