Skip to content

Commit 6bfc18e

Browse files
authored
Put pyi dirs at the end of the mypy path (#81)
The order of these matter if there are potential conflicts in the MYPYPATH. Similar to generated_dirs I think it makes sense to keep the generated file directories after the source file directories in case there are conflicts. This caused failures in our project since 411f64c
1 parent 2590cee commit 6bfc18e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mypy/private/mypy.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def _mypy_impl(target, ctx):
144144

145145
# types need to appear first in the mypy path since the module directories
146146
# are the same and mypy resolves the first ones, first.
147-
mypy_path = ":".join(sorted(types) + sorted(pyi_dirs) + sorted(external_deps) + sorted(imports_dirs) + sorted(generated_dirs) + sorted(generated_imports_dirs))
147+
mypy_path = ":".join(sorted(types) + sorted(external_deps) + sorted(imports_dirs) + sorted(generated_dirs) + sorted(generated_imports_dirs) + sorted(pyi_dirs))
148148

149149
output_file = ctx.actions.declare_file(ctx.rule.attr.name + ".mypy_stdout")
150150

0 commit comments

Comments
 (0)