Include external srcs for mypy dep analysis with pip_install #43
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.
At present, because external deps are skipped,
requirement()
-based imports don't work. This causes issues for python rules that are trying to use pip_install.This makes a series of changes in order to enable
requirement()
compatibility:include_imports
, defaulting False, to enable new behavior.//foo:bar
would run from thefoo
directory;../
is added to imports in that case so that they're found correctly. The resulting mypy path will look like../py_deps/pypi__pygithub
, allowingimport github
to resolve to../py_deps/pypi__pygithub/github
.--follow-imports=silent
is added to avoid printing errors on imported files.--exclude
may work better in the future (because it could be given the list of import paths), but isn't available at the current version of mypy in use by this rule.This might fix #39, and may also help with #23 (although this may not interact correctly -- smarter import handling may be needed, this is really
requirement()
-focused).