Commit f6fb736
committed
fix(release): resolve an interpreter that has tomllib
`./scripts/release.sh prepare minor` fails outright on macOS:
ModuleNotFoundError: No module named 'tomllib'
tomllib is stdlib only from 3.11, and `python3` on macOS is 3.9. Every helper
in the script -- get_version, get_pkg_name, set_version, bump_version, the
changelog update, and the publish-time changelog check -- hardcoded `python3`,
so releasing this package was impossible on such a machine. The error names a
missing module, which reads as a broken checkout rather than a too-old
interpreter.
Resolved once at load time instead of per call site: `python3` when it can
actually import tomllib, else `uv run`, else a message that says what is
needed and what was found. uv is the right fallback because this repo already
builds and tests through it, so a machine that can run the suite can run the
release.
The two `need python3` guards are dropped as redundant -- resolve_python has
already exited with a better message by then.
Verified under bash, which is how the script runs:
PY_BIN=uv run --no-project --python 3.12 python
version=0.10.0 pkg=hotdata-framework
minor=0.11.0 patch=0.10.1 major=1.0.0
and with no usable interpreter on PATH:
error: need python3 >= 3.11 (for tomllib) or uv; python3 is Python 3.9.6
No behaviour change to what a release does -- only which interpreter runs it.
Note the same hardcoded `python3 - <<PY` + tomllib pattern is in sdk-python's
and hotdata-marimo's copies of this script, so both are latently broken the
same way on a pre-3.11 `python3`. Not touched here.1 parent d1d6a1c commit f6fb736
1 file changed
Lines changed: 25 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
10 | 29 | | |
11 | 30 | | |
12 | 31 | | |
| |||
24 | 43 | | |
25 | 44 | | |
26 | 45 | | |
27 | | - | |
| 46 | + | |
28 | 47 | | |
29 | 48 | | |
30 | 49 | | |
31 | 50 | | |
32 | 51 | | |
33 | 52 | | |
34 | 53 | | |
35 | | - | |
| 54 | + | |
36 | 55 | | |
37 | 56 | | |
38 | 57 | | |
| |||
41 | 60 | | |
42 | 61 | | |
43 | 62 | | |
44 | | - | |
| 63 | + | |
45 | 64 | | |
46 | 65 | | |
47 | 66 | | |
| |||
56 | 75 | | |
57 | 76 | | |
58 | 77 | | |
59 | | - | |
| 78 | + | |
60 | 79 | | |
61 | 80 | | |
62 | 81 | | |
| |||
95 | 114 | | |
96 | 115 | | |
97 | 116 | | |
98 | | - | |
| 117 | + | |
99 | 118 | | |
100 | 119 | | |
101 | 120 | | |
102 | 121 | | |
103 | 122 | | |
104 | 123 | | |
105 | | - | |
106 | 124 | | |
107 | 125 | | |
108 | 126 | | |
| |||
151 | 169 | | |
152 | 170 | | |
153 | 171 | | |
154 | | - | |
155 | 172 | | |
156 | 173 | | |
157 | 174 | | |
| |||
166 | 183 | | |
167 | 184 | | |
168 | 185 | | |
169 | | - | |
| 186 | + | |
170 | 187 | | |
171 | 188 | | |
172 | 189 | | |
| |||
0 commit comments