Commit 272a1ea
authored
Determine development version hash without running git (#21212)
We've called git in a subprocess so that we can include
git version hash in the version (like
`2.0.0+dev.32f307a7cca81c13db6bf6a7984493cefebd7b1e`). This
happens with development versions run in the git mypy repo.
Running git as a subprocess can dominate mypy startup time in certain
environments, so this PR adds logic to figure out current HEAD hash
without running git. I've seen the git invocations add 200ms+ to mypy
runtimes.
Unfortunately, we can't easily figure out if .dirty should be
added without git, so I'm just removing it altogether from the version.
Since startup overhead becomes a worse issue when using parallel
type checking, not having .dirty support seems like a smaller issue
than slow startup.
This was written using Claude Code.1 parent f315c8a commit 272a1ea
2 files changed
+41
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
31 | 66 | | |
32 | 67 | | |
33 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
0 commit comments