python-language-server icon indicating copy to clipboard operation
python-language-server copied to clipboard

Resolve imports for modules that manipulate __path__

Open jdormit opened this issue 5 years ago • 0 comments

Suppose I have the following directory structure:

.
├── module
│   └── stuff
│       └── __init__.py
└── real-module
    └── stuff
        └── foo
            └── __init__.py

And the contents of module/stuff/__init__.py is:

from os import path

module_path = path.join(__file__, "..", "..", "..", "real-module", "stuff")

__path__.append(module_path)
execfile(path.join(module, "__init__.py"))

Then any code that imports module.stuff.foo will actually end up with real-module/stuff/foo. However, pyls doesn't follow the dynamic __path__ generation here. Is there any way I can configure pyls to tell it that module.stuff.foo is actually real-modules/stuff/foo?

jdormit avatar May 01 '20 15:05 jdormit