PyCQA / PyCQA/isort

Sorting order is broken and not following standard sort order

Open
#2,239 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7k
Forks
687
Avg merge
4h 56m
Merged PRs (30d)
2

Description

I love the idea of isort! Genius! However, I know the recommended way to sort in Python is something like this:

On Top: standard libraries
Middle: third party libraries
Bottom: packages/files defined locally (in the tree where this files resides)

This doesn't seem to be the case with isort and I cannot find hardly anything online about it. Sometimes the lines are not even sorted alphabetically, and also it doesn't seem to differentiate between pip packages and local packages as my pip packages are at the bottom most times. I have tried testing this on several files and projects on different computers with different VScode configurations and even clean vscode installs, and I don't really see the pattern working to the Python standard. It is possible to configure isort so that it does sort to the python standard?

I have tried with the autopep8 and black formatters. With the recommended json settings config. The sort happens, but it is sorting incorrectly to my understanding.

Thanks in advance for the help! I am really hoping to get this sort working properly or to be educated by someone if I am completely missing something.

Cheers,
Chase

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported ordering with isort, the mentioned VS Code JSON settings, autopep8, and black across the described standard-library, third-party, and local imports. Review the issue discussion for an agreed expected order; done means the behavior is either corrected to that order or the supported configuration and rationale are clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.