New feature: isort should move module-level-dunders to the correct place
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7k
- Forks
- 687
- Avg merge
- 4h 56m
- Merged PRs (30d)
- 2
Description
I can see in a related issue #711 dunders were at least prevented from moving. However, according to PEP8, dunders should come after future imports but before the other import block.
This is correct according to PEP8
from __future__ import barry_as_FLUFL
__all__ = ["barry_as_FLUFL"]
__version__ = '0.1'
__author__ = 'someone'
import os
import sys
This is incorrect
from __future__ import barry_as_FLUFL
import os
import sys
__all__ = ["barry_as_FLUFL"]
__version__ = '0.1'
__author__ = 'someone'
But currently isort does not move the dunders. I propose this is implemented to correctly align with PEP8.
Related pylint issue https://github.com/PyCQA/pylint/issues/5471
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
No implementation file or test is named. Start by reproducing the two import-ordering examples and trace how isort handles module-level dunders relative to future imports and regular imports. Done means dunders are placed between those blocks according to PEP8, with regression coverage for the shown ordering.
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
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100