Skip to content
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

#14014 broke mypy integration in combination with custom mypy plugins and editable installs #15017

Closed
elprans opened this issue Dec 19, 2020 · 2 comments
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@elprans
Copy link

elprans commented Dec 19, 2020

Environment data

  • VS Code version: 1.52.1
  • Extension version (available under the Extensions sidebar): v2020.12.424452561
  • OS and version: Linux
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.8
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv
  • Relevant/affected Python packages and their versions: all of them

We use a custom mypy plugin in a project that is also commonly installed in "editable mode" (pip install -e). Editable mode installs do not link files to site-packages and instead populate the easy-install.pth file, which is used to populate sys.path.

Since the change in #14014, the extension is removing the value matching that of the workspace directory, which would match the value in easy_install.pth, effectively removing the entire project from sys.path and making the plugins invisible to mypy, which will make it crash on launch.

Note that this behavior isn't specific to mypy. Any similar customization of a lint tool (e.g. flake8) is similarly broken.

@elprans elprans added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Dec 19, 2020
@elprans
Copy link
Author

elprans commented Dec 19, 2020

If I may, a better fix for the "don't add the script directory to sys.path" would be to run pythonFiles/pyvsc-run-isolated.py using some random empty working directory, and then restoring the correct cwd with os.chdir().

@brettcannon
Copy link
Member

This is a duplicate of #14570 (and thanks for the suggestion of the fix!).

@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Dec 21, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

2 participants