-
Notifications
You must be signed in to change notification settings - Fork 770
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
Advice on fixing attrs import quick-fix #5388
Comments
@heejaechang is the expert here, and may correct me. But I believe that this is because when our indexer finds aliases, it will deduplicate them down to the one "best" location. We'll choose the one with the shortest module path (shortest in terms of levels). When the length is the same, as in this case where Assuming I'm correct, you could fix this on your side by making We recently special-cased the symbols that are both in It would be nice if package authors could control this somehow, but I don't have any good ideas. |
Interesting. I'm going to talk to Hynek and see if we can do this. Thanks for the info @debonte ! |
Ok, but I want to clarify that this deduplication approach is just Pylance's convention. Other language servers (ex. PyCharm) may behave differently. |
I got the boss to accept this change!
Sure, but I use VS Code and I really wanted to scratch this itch ;) |
Howdy.
I'm one of the maintainers of the attrs library and avid VS Code user. When attempting to auto-import the
define
attrs function, the quick fix popup suggests importing it from theattr
package, instead of fromattrs
.The attrs library contains two packages,
attr
andattrs
. Theattr
package, while not deprecated, is legacy at this point.define
is part of our next-gen API, and ideally the suggestion would be to import it fromattrs
instead. (The same goes for some other symbols, likefrozen
andfield
.)What can we do to make this better, either on our side (maybe it's a packaging issue?) or on yours?
The text was updated successfully, but these errors were encountered: