Trailing comment removed from `as` imports with `combine_as_imports = true` and `force_single_line = true`
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7k
- Forks
- 687
- Avg merge
- 4h 56m
- Merged PRs (30d)
- 2
Description
Summary
With combine_as_imports = true and force_single_line = true, trailing comments are removed from lines with as imports.
Versions
Python v3.11.0
isort v5.12.0
Config
# pyproject.toml
combine_as_imports = true
force_single_line = true
Input
from other_module import other_function # type: ignore [import] # pylint: disable=no-name-in-module
from some_module import the_function as some_function # type: ignore
from some_other_module import another_function as yet_another_function # type: ignore [import] # pylint: disable=no-name-in-module
Expected output
Comments preserved
Actual output
from other_module import \
other_function # type: ignore [import] # pylint: disable=no-name-in-module
from some_module import the_function as some_function
from some_other_module import another_function as yet_another_function
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the stated pyproject.toml settings and the three provided Python imports. Trace the formatting path for combined as imports, then verify that trailing comments remain on all affected lines and that the existing output is unchanged where comments are absent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100