Skip to content

fix: make python 3.14 the default - #110

Merged
catinspace-au merged 3 commits into
mainfrom
fix/python-314
Oct 6, 2026
Merged

catinspace-au merged 3 commits into
mainfrom
fix/python-314

Conversation

@catinspace-au

Copy link
Copy Markdown
Contributor

Python 3.14 is now the default, both for the repo's own tooling and for the Python a converged box gets from uv.

  • The astral role pins uv's global default to astral_python_version (3.14). It installs a uv-managed 3.14 only where the system python3 is older: Ubuntu 24.04 and macOS. Fedora 43/44 and Ubuntu 26.04 already ship 3.14, so they keep it, and no copy shadows the distro python3.14. No --default, so python/python3 stay the system ones.
    • A failed download goes to the end-of-run report rather than stopping the converge.
    • The role rewrites the global pin every run. Override it with astral_python_version.
  • hyperi-rust-setup runs on the uv 3.14 when it is there and executable, else python3. A non-zero exit is now reported. Before, it was dropped silently, and on a stock Mac (CLT Python 3.9) it always failed. Run by hand on 3.9, it hands itself over to the uv 3.14, or says which Python it needs.
  • developer-rust declares astral as a dependency, so a developer-rust run has the uv Python in place first.
  • hyperi-rust-cache-prune runs on 3.9 again (macOS launchd). It reads cargo's [build] keys without tomllib there, and it treats anything it cannot read exactly as unconfigured, so it prunes nothing.
  • tools/hyperi-doctor picks the first Python that is 3.11+ with PyYAML, else uv run --with pyyaml.
  • The repo's own tools target 3.14 (.python-version). They drop from __future__ import annotations, which scripts in roles/*/files keep because they run on 3.12 and 3.9 hosts.

Tested in containers:

  • The astral converge on ubuntu:24.04, ubuntu:26.04 and fedora:44 gave changed=0 on the second run, with the system python3 byte-identical. uv python find gives the managed 3.14 on 24.04 and the system 3.14 on the other two.
  • An offline converge completes with a warning.
  • A dangling python3.14 link falls back to python3.
  • cache-prune and the setup hand-over were run on python:3.9-slim.
  • tools tests: 106 passed.

Not run: anything on macOS, and a full developer-rust converge.

Ruff and ty never run on this repo's Python in CI (#108). On a Mac, install.sh still builds Ansible from the Command Line Tools' Python 3.9 (#109).

Done when a converged box resolves Python 3.14 through uv and every host-side script still runs on the system python3.

The astral role now installs Python 3.14 through uv and pins it as uv's global default, per user. Ubuntu 24.04 and macOS get the same interpreter as Fedora and Ubuntu 26.04, and the system python3 is left alone, so there is no --default and no python3 shim in ~/.local/bin. The pin is read first and only rewritten when it differs, so a second converge reports nothing changed. The version is astral_python_version.

The repo's own tooling moves to the 3.14 floor: a root .python-version, and tools/ drops `from __future__ import annotations`, which 3.14 makes redundant. The tools still run on 3.12.

hyperi-rust-cache-prune crashed on macOS, where launchd runs it with the Command Line Tools' Python 3.9: `int | str` annotations raised at import, and tomllib does not exist before 3.11. It now keeps annotations unevaluated and, without tomllib, reads the two [build] keys it needs itself. The other host-side scripts keep their floors.

The utilities.yml comment no longer claims ansible is a uv tool on macOS.
hyperi-rust-setup imports tomllib, which macOS's Command Line Tools Python 3.9 does not have. Its task now runs it with the astral role's ~/.local/bin/python3.14 where that exists, and python3 otherwise, the same rule on every OS. developer-rust now depends on astral, so that interpreter exists on `--tags developer-rust` alone and in developer-languages, which lists this role ahead of the base. A non-zero exit still does not abort the run, but it now lands in deploy_warnings with the last stderr line, and the report shows stderr as well as stdout.

The hyperi-doctor wrapper picks the first interpreter that is 3.11+ and has PyYAML, trying ~/.local/bin/python3.14 before python3. The uv-managed Python has no PyYAML, so Linux keeps using the distro python3. Where neither passes, as on a stock Mac, it falls back to `uv run --with pyyaml`.

check_release_matrix.py and hyperi_doctor.py carry a shebang and a main guard, and are now executable.
A failed Python download no longer fails the base converge. The install and pin sit in a block whose rescue records a deploy warning, and the pin is skipped when the install fails, since a pin to a missing Python breaks uv.

uv only installs its own Python where the system python3 is older than astral_python_version, read from /usr/bin/python3. Fedora 43+ and Ubuntu 26.04 keep their system 3.14: Fedora's packaged uv prefers it anyway, and a managed python3.14 in ~/.local/bin hid dnf-installed modules from a typed python3.14. The global pin is still set everywhere, and the defaults now say it replaces a user's own.

The hyperi-rust-setup task follows the ~/.local/bin/python3.14 link and needs it executable, so a dangling link falls back to python3. Its warning falls back to the module message when stderr is empty and is deduplicated, since developer-rust can run twice. Run by hand on a Python without tomllib, the script hands over to ~/.local/bin/python3.14, or exits 2 naming the Python it needs.

The cache-prune fallback reader treats a file with a multi-line string, a repeated [build] key or a repeated [build] table as unconfigured. "Load macOS variables" carries the python tag, so `--tags python` works on macOS.
@catinspace-au
catinspace-au merged commit ed74099 into main Oct 6, 2026
18 checks passed
@catinspace-au
catinspace-au deleted the fix/python-314 branch October 6, 2026 09:34
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant