isort
isort copied to clipboard
namespace package sorts differently when using the `from namespace import x` form
Given a configuration file like this:
[tool.isort]
import_heading_firstparty="First party"
import_heading_thirdparty="Third party"
known_first_party = ["namespace.mymodule"]
default_section = "THIRDPARTY"
And an input file like this:
import namespace.mymodule
from namespace import mymodule
Installing isort[pyproject]
(==4.3.21
), I get:
# Third party
from namespace import mymodule
# First party
import namespace.mymodule
Normally this would not be a problem because you can put "namespace"
into known_first_party
, but when the namespace is backports
or some other shared namespace, there are both first- and third-party packages in there. It seems to me that in the case of from x import y
, the sorting should be based on x.y
, not on x
.
i want to work on this can you assign it to me
@jhabarsingh, thank you for the help! I've assigned the issue to you. Let me know if I can assist at any point :)
@jhabarsingh, are you still interested in taking this on? Anything I can do to help?
Thanks!
~Timothy
I would love to work on this but I am not getting how to start, I would be glad if you guide me.