[question] Is it possible to remove newlines between `__future__`, `from` and `import`?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7k
- Forks
- 687
- Avg merge
- 4h 56m
- Merged PRs (30d)
- 2
Description
Attempting to use isort to style in the following manner:
- Individual imports on their own line.
- No sections; sort everything in alphabetical order but still respecting
__future__imports.
The closest configuration I can define to produce this is the following:
[isort]
force_alphabetical_sort = 1
force_single_line = 1
line_length = 9999
no_sections = 1
However, there are empty newlines injected between the __future__, from and import definitions. For example:
from __future__ import print_function
from __future__ import unicode_literals
from collections import defaultdict
from myproject import Entity
from os import path
import io
try:
basestring
except NameError:
basestring = str
I am hoping to produce output such as the following:
from __future__ import print_function
from __future__ import unicode_literals
from collections import defaultdict
from myproject import Entity
from os import path
import io
try:
basestring
except NameError:
basestring = str
I have tried the lines_* options to attempt to remove these newlines, but I have had no luck. Is there an option I am missing that can help achieve this?
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
Start with isort's documented configuration options, especially force_alphabetical_sort, no_sections, and the lines_* settings, then trace how future, from, and import statements are grouped. Confirm whether the requested output can be represented by existing configuration; if not, define the option behavior and add coverage for the two example layouts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100