Commit 03176cd
Harden uv Python compatibility for inline scripts (#1733)
## Context
Inline-script environment creation selects an installed Python when
possible and falls back to installing a compatible Python with uv. The
fallback has to use the same PEP 440 semantics before and after
installation; otherwise setup can download Python successfully and then
reject it.
This remains behind the undeclared, default-off inline-script feature
flag.
## Why this change is needed
Two compatibility paths were inconsistent:
- A directly resolved Python was checked by the release-segment-only
helper before the manager's strict PEP 440 check. This could reject a
compatible final release, such as Python 3.15.0 for `!=3.15.0rc2`.
- A short exact requirement such as `==3.13` could be passed to uv as
the broad selector `3.13`. uv may install a later 3.13 patch, while
strict PEP 440 equality requires 3.13.0.
The default uv catalog can also omit older patch releases. A strict
short-exact lookup therefore needs an all-versions catalog to find
3.13.0 after newer 3.13 releases exist.
## What changed
- Direct post-install resolution now keeps the existing Python 3, error,
executable, and canonical-path guards while using strict PEP 440
compatibility.
- Short exact equality resolves through a concrete uv catalog result
instead of forwarding a broad minor selector.
- Only the short-exact path requests `uv python list --all-versions`;
existing catalog callers retain their previous command arguments.
- Fully specified exact versions, simple lower bounds, bounded ranges,
exclusions, prerelease/dev requirements, no-requirement behavior, and
quick-create prompt suppression remain unchanged.
## Behavior and compatibility
- No setting, command, menu, view, or status-bar contribution is added.
- The inline manager remains unregistered while the feature flag is off.
- Non-inline uv and package-management flows keep their existing
behavior.
- Failures remain fail-closed: no incompatible cache environment is
created.
## Reviewer guide
1. Review the strict direct-resolution guard in
`inlineScript/envManager.ts`.
2. Review short-exact catalog selection and the `allVersions` option.
3. Review uv command-argument tests, then the manager compatibility
regressions.
## Validation
- `npm run compile-tests --silent`
- Targeted inline manager, uv installer, and interpreter suites: 311
passing
- ESLint on changed TypeScript files
- `git diff --check`
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent c6b1e27 commit 03176cd
4 files changed
Lines changed: 119 additions & 12 deletions
File tree
- src
- managers/builtin
- inlineScript
- test/managers/builtin
- inlineScript
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2363 | 2363 | | |
2364 | 2364 | | |
2365 | 2365 | | |
2366 | | - | |
| 2366 | + | |
| 2367 | + | |
| 2368 | + | |
| 2369 | + | |
| 2370 | + | |
| 2371 | + | |
2367 | 2372 | | |
2368 | 2373 | | |
2369 | | - | |
2370 | | - | |
2371 | | - | |
2372 | | - | |
2373 | | - | |
2374 | | - | |
2375 | | - | |
| 2374 | + | |
| 2375 | + | |
| 2376 | + | |
| 2377 | + | |
| 2378 | + | |
2376 | 2379 | | |
2377 | 2380 | | |
2378 | 2381 | | |
| |||
2403 | 2406 | | |
2404 | 2407 | | |
2405 | 2408 | | |
| 2409 | + | |
2406 | 2410 | | |
2407 | 2411 | | |
2408 | 2412 | | |
2409 | 2413 | | |
| 2414 | + | |
2410 | 2415 | | |
2411 | | - | |
| 2416 | + | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
2412 | 2420 | | |
2413 | 2421 | | |
2414 | 2422 | | |
| |||
2424 | 2432 | | |
2425 | 2433 | | |
2426 | 2434 | | |
2427 | | - | |
| 2435 | + | |
| 2436 | + | |
| 2437 | + | |
2428 | 2438 | | |
2429 | 2439 | | |
2430 | 2440 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
79 | 83 | | |
80 | 84 | | |
81 | 85 | | |
| |||
276 | 280 | | |
277 | 281 | | |
278 | 282 | | |
| 283 | + | |
279 | 284 | | |
280 | 285 | | |
281 | | - | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
282 | 289 | | |
283 | 290 | | |
284 | | - | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
285 | 297 | | |
286 | 298 | | |
287 | 299 | | |
| |||
Lines changed: 59 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
744 | 744 | | |
745 | 745 | | |
746 | 746 | | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
747 | 766 | | |
748 | 767 | | |
749 | 768 | | |
| |||
834 | 853 | | |
835 | 854 | | |
836 | 855 | | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
837 | 896 | | |
838 | 897 | | |
839 | 898 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
835 | 835 | | |
836 | 836 | | |
837 | 837 | | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
838 | 864 | | |
839 | 865 | | |
840 | 866 | | |
| |||
0 commit comments