Import resolution doesn't understand editable installation with a non-standard package-dir
.
#5544
Replies: 5 comments
-
What's in the Is your venv the selected interpreter within VS Code? See the "Python: Select Interpreter" command in the command palette. |
Beta Was this translation helpful? Give feedback.
-
The import __editable___myproj_1_finder; __editable___myproj_1_finder.install() which corresponds to a file MAPPING = {'myproj': 'C:\\Users\\Andrew\\Code\\Issue\\src'}
NAMESPACES = {}
PATH_PLACEHOLDER = '__editable__.myproj-1.finder' + ".__path_hook__ And the rest of the file seems to be boilerplate / not specific to My default Python interpreter path is For reference, I'm using Python 3.12.1 |
Beta Was this translation helpful? Give feedback.
-
I installed it in compat mode, so now the |
Beta Was this translation helpful? Give feedback.
-
I see. We don't support that. Our support for editable installs is limited to simple (non-hook) You could make your scenario work by adding a symbolic link: Improving editable install support isn't a high priority for us at the moment. If you'd like, I can turn this into an enhancement discussion and we can see if it gets enough up-votes to get onto our radar. |
Beta Was this translation helpful? Give feedback.
-
Moving this issue to discussion as an enhancement request for comments and upvotes. |
Beta Was this translation helpful? Give feedback.
-
Environment data
Code Snippet
If myproj is imported in editable mode and there isn't a
myproj/
directory anywhere, pylance marks it as a missing import.Repro Steps
Create a directory structure like
Where
pyproject.toml
is__init__.py
isand the venv is created with
python -m venv .venv
. Run.\.venv\Scripts\activate
and thenpip install -e .
.Expected behavior
Pylance should inform me that
src.module
is an error via reportMissingImports, whilemyproj.module
should be understood as valid.Actual behavior
It does the opposite; it likes
src.module
, while throwing reportMissingImports atmyproj.module
.Logs
There's not really any relevant logs.
I'm aware that either
It's just been bothering me for weeks. Thank you for your help!
Beta Was this translation helpful? Give feedback.
All reactions