Skip to content

Commit 55359ee

Browse files
authored
Keep track of fine-grained deps for modules in typeshed (#10034)
Even if we assume that typeshed stubs don't change, we need the deps when bringing in new stubs when following imports during a fine-grained increment. This fixes false positives when following imports to `six` and `requests`. Some modules are always part of the initial build, and we can still skip generating deps for them, as an optimization. I only tested this manually, since I couldn't figure out an easy way to reproduce the issue in our tests. Fixes #10033.
1 parent a1a74fe commit 55359ee

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

mypy/build.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2205,12 +2205,14 @@ def _patch_indirect_dependencies(self,
22052205

22062206
def compute_fine_grained_deps(self) -> Dict[str, Set[str]]:
22072207
assert self.tree is not None
2208-
if '/typeshed/' in self.xpath or self.xpath.startswith('typeshed/'):
2209-
# We don't track changes to typeshed -- the assumption is that they are only changed
2210-
# as part of mypy updates, which will invalidate everything anyway.
2211-
#
2212-
# TODO: Not a reliable test, as we could have a package named typeshed.
2213-
# TODO: Consider relaxing this -- maybe allow some typeshed changes to be tracked.
2208+
if self.id in ('builtins', 'typing', 'types', 'sys', '_typeshed'):
2209+
# We don't track changes to core parts of typeshed -- the
2210+
# assumption is that they are only changed as part of mypy
2211+
# updates, which will invalidate everything anyway. These
2212+
# will always be processed in the initial non-fine-grained
2213+
# build. Other modules may be brought in as a result of an
2214+
# fine-grained increment, and we may need these
2215+
# dependencies then to handle cyclic imports.
22142216
return {}
22152217
from mypy.server.deps import get_dependencies # Lazy import to speed up startup
22162218
return get_dependencies(target=self.tree,

0 commit comments

Comments
 (0)