`lines_before_import` adds newlines above module's docstring when used with `float_to_top`
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7k
- Forks
- 687
- Avg merge
- 4h 56m
- Merged PRs (30d)
- 2
Description
Using MacOS, python 3.7.11, isort 5.10.1, and the following config in pyproject.toml:
[tool.isort]
lines_before_imports = 1
float_to_top = true
Before running isort tmp.py:
"""
Tmp module.
"""
import os
os.getcwd()
After:
"""
Tmp module.
"""
import os
os.getcwd()
(note the added leading empty line)
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 behavior using the shown pyproject.toml settings and tmp.py, then trace how float_to_top and lines_before_imports handle a module docstring. Done means isort no longer adds a leading blank line before the docstring while retaining the expected spacing around imports and the following code.
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
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 65/100