-
Notifications
You must be signed in to change notification settings - Fork 130
Two modules with identical names create a conflict #443
Comments
Promoting, there are user-reported issues on this. @jakebailey can add links. |
#1360 is the concrete example with more comments about this. Doing a depth sort as I almost did in #1289 "helps" but disallows valid import names. I'd think we need to have the following: The import resolver doesn't do the "carving" thing anymore, and instead allows multiple names for the same module. Since we have |
We most probably need this for persistence in some form so we can tell which module the type is from correctly. |
For the fix, we need to define how module should be chosen if we have several modules matching the same name. python itself iterates through the |
I think there are 2 cases
|
Doing it by path order is important, yeah. I'd imagine that since this ordering impacts what a module sees in its imports, the "unique ID" may need to involve that as well (i.e. if I install |
My other thought was that we could still have a unique name in the dependency resolver, but expose them as the requested name through some sort of shim (i.e. if they have |
|
|
One name isn't enough anyway, because name of the module depends on the referencing module. For example, for the file structure:
and import a
import src.a
import package.b
import src.package.b we should import all four modules if On the other hand, completions, hover and other analysis-based features operate on top of |
On the side note, we need to remember that module wins over implicit package:
No matter what path goes first - |
When using this extension https://github.com/microsoft/vscode-python-embedded , people create |
These two modules will have the same name. As a result, one will be overridden by the other in
ModuleTable
.See also
ImportTests.Completions_ImportResolution_OneSearchPathInsideAnother
The text was updated successfully, but these errors were encountered: