Add support for type checking with mypy plugins #121
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm not totally sure if this approach always works or if there's stuff that I'm missing, but it seems to work. I'll try to explain myself here.The change utilisespip
's--target
(docs) argument to point out where to install a project's additional dependencies, passed in viapip_cmd
. This replaces the virtual env creation for each project, since that shouldn't be necessary (I think?).In addition to what's mentioned abovewe start setting thePYTHONPATH
env variable(docs), to point out an additional search path for module files, namely the site-packages directorywith the additional dependenciesinside the project's virtualenv.That should allow discovery of project dependencies while keeping the installed mypy versions independent and reusable.
Outdated
All this isn't included, but I was thinking that it should be possible to use
pip install --target
for both mypy installations as well, instead of a virtual env. That leads to having 1 python/pip executable, 1 directory fornew_mypy
, 1 directory forold_mypy
and then all project dependency installations. Although I'm unsure what--python-executable=
does and if it could be affected. I'm also not sure how to handle compiled mypy.Essentially what'll happen with the above changes is that we'll have a directory structure like e.g.
We run mypy with something corresponding to
Here's some example debug output: