https://pantsbuild.org/ logo
#development
Title
# development
w

witty-crayon-22786

05/18/2022, 10:32 PM
random thought: whether
mypy
needs to check transitive dependees is dependent on whether a file “exports” a type… and the same goes for
javac
, where we actually implemented “exports” (described in the JVM inference post)
but there is some … circularity … involved in actually figuring out which types are exported. we can do it in Java because return types and non-local variables must have their types declared, and so dependency inference can indicate that certain symbols get exported.
doing the same with mypy would involve recursively invoking mypy … upward in the graph …? with a plugin that told you which other modules a file consumed…?
b

bitter-ability-32190

05/18/2022, 10:41 PM
What would be the gain?
w

witty-crayon-22786

05/18/2022, 11:04 PM
if you change an implementation detail (such as a method body) rather than a public API like a return type or method, then we would not need to
check
dependees
🤔 1
b

bitter-ability-32190

05/18/2022, 11:06 PM
I think wiring the mypy cache gets us a lot fo the way for perf. This would be an orthogonal bonus perf
w

witty-crayon-22786

05/18/2022, 11:07 PM
yea.
it’s primarily significant in huge repos
cc @ancient-vegetable-10556 since you worked on exports
b

bitter-ability-32190

05/18/2022, 11:08 PM
Seems doable assuming we could ask mypy for the info
You'd need to run using the users mypy PEX IMO,so it'd need to be supported across a wide range of versions
w

witty-crayon-22786

05/18/2022, 11:10 PM
yea, tricky. and actually, unlike dependency inference in general, getting this wrong could lead to under-checking/compilation.
(i.e.: if you fail to notice an export, you don’t check a dependee that you did need to check.)
1
h

happy-kitchen-89482

05/18/2022, 11:58 PM
Supporting the mypy cache and daemon might be bigger wins?
1
h

hundreds-father-404

05/19/2022, 12:03 AM
yeah mypy is already pretty fast w/o pants
b

bitter-ability-32190

05/19/2022, 12:04 AM
@hundreds-father-404 that's what I said about `black`and it's cache 😹
But also yeah I think cache would be a heavy hitter. In the spirit of blazing fast CI though: porque no Los dos?
☝️ 1
h

happy-kitchen-89482

05/19/2022, 7:29 PM
Porque esto es complicado?
🇲🇽 2
b

bitter-ability-32190

05/19/2022, 7:31 PM
I think the two ideas are orthogonal enough to not complicate each other