-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Third-party namespace packages can be incorrectly considered first-party packages by isort
rules
#12984
Comments
Hi @tehkirill This behavior changed with Ruff 0.6 where the directory You can read more about it in our blog post. |
Thanks for the prompt response and linking to where it was documented, @MichaReiser The way it's implemented at the moment makes sense for projects without namespaces, eg It does, however, incorrectly identifies a third-party import under the same namespace as first-party, e.g. using an example from packaging.python.org:
When working on |
That's an interesting edge case! This seems to me to be a general issue with the way our |
isort
rules
I ran into the same problem recently but thought I was just too stupid to find the right settings combination. I opened a discussion about it here: #12038 We did not find a solution back then and I went on to other tasks. Now I revisted this and found this issue. I built We now need to have this merged... |
Hi, team. Thanks for your hard work.
I noticed a change in how known-first-party imports get classified recently.
If I'm working on
my_namespace.a
project, I expectmy_namespace.b
to be classified as a Known(ThirdParty) (so doesisort
). This was the case with ruff as well, up until version 0.5.7 .Working on
my_namespace.a
project, with the following stucture:^ I see it as a valid import order, so does v0.5.6:
But 0.5.7+ (including the latest 0.6.1) sees otherwise:
Removing
src/my_namespace
correctly classifiesmy_namespace.b
as known-third-party again.The text was updated successfully, but these errors were encountered: