vscode-python: Intellisense doesn't respect absolute imports (Jedi)
Environment data
- VS Code version: 1.25.1
- Extension version (available under the Extensions sidebar): 2018.7.0
- OS and version: MacOS 10.13.5
- Python version (& distribution if applicable, e.g. Anaconda): all
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): venv, virtualenv, conda, or none
- Relevant/affected Python packages and their versions: any
Actual behavior
Given a local package or module that has the same name as an installed package, for example:
my_project
| my_package
| __init__.py
| celery.py
Contents of my_project/my_package/celery.py
:
from __future__ import absolute_import # for compatibility with python 2
import celery
celery.Celery('tasks')
Contents of my_project/my_package/__init__.py
:
Intellisense treats import celery
line as importing local module (the current file) into its self instead of the top level package.
Expected behavior
Intellisense should import the global package (celery
in this example), not the local module (my_project.celery
)
Steps to reproduce:
- create a package or module with the same local name as another package or module in python’s path.
- import the package or module
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 2
- Comments: 19 (10 by maintainers)
@moi90 best option would be to use the Microsoft language server.
I’m going to re-open this issue to be triaged so we can see if there’s anything we can do or if it’s entirely up to Jedi to fix.
FYI, with that last bit of info I was able to reproduce the problem under Python 3.7 on linux. Intellisense is showing completions for the local module rather than the installed package.