[PATCH 00/12] python: require python3.12+
John Snow <[email protected]>
| Newsgroups | org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
The stars have aligned, and we can jump all the way from Python3.9 to Python3.12. GitLab CI: https://gitlab.com/jsnow/qemu/-/pipelines/2781408192 Python 3.9 is EOL, and Python 3.10 will be EOL in about two months (October 2026). Python 3.11 is, to be blunt, perfectly serviceable - but when investigating our actual minimum dependency requirements, I realized none of our supported platforms used anything older than Python 3.12, so we may as well build and test with the version that all of our build platforms are actually using. This reduces the Python compat test matrix by quite a lot and allows us a few nice things. From memory, the highlights are: - Pattern matching syntax (fancy case statements). I am not dying to use these anywhere, but they're nice! - Vastly improved error reporting from CPython - Ability to annotate exceptions with "notes", which allows us augment the default reporting behavior for unhandled exceptions - this can be used in e.g. iotests to help give additional information on tool crashes that is sometimes hard to discover otherwise - The ability to use standard library types for typing syntax instead of importing from Typing (Technically, valid since 3.9, but...) - The ability to use "x | y" instead of Union[x, y] in type hint syntax. Combined with the above, it's a good time to clean up the typing in qapi to make it read much more nicely. - ExceptionGroups - the ability to capture and report multiple exceptions simultaneously. This is extremely useful for async QMP and managing multiple VMs from a single python context. Async QMP will be able to get a few nice QOL improvements with this. My personal favorite: - We can move to a much newer Sphinx, which gets rid of an awful lot of very ugly compat code. This is the *actual* motivation of this series. Anyway, here's the version chart for our supported build platforms and why this is safe to do: distro EOS python3 pip setuptools sphinx wheel ------------------------------------------------------------------------- centos_stream_9 2026-12-12 3.9.25 21.3.1 53.0.0 3.4.3 0.36.2 centos_stream_9+ 2026-12-12 3.12.13 23.2.1 68.2.2 --- 0.41.2 freebsd -- 3.12.14 23.3.2 63.1.0 9.0.4 0.48.0 ubuntu_24_04 2028-04-23 3.12.3 24.0 68.1.2 7.2.6 0.42.0 centos_stream_10 2030-01-01 3.12.13 23.3.2 69.0.3 7.2.6 0.41.2 alpine_3_21 2026-11-01 3.12.14 24.3.1 70.3.0 8.1.3 0.43.0 debian_13 2028-08-09 3.13.5 25.1.1 78.1.1 8.1.3 0.46.1 fedora_43 2026-12-09 3.14.7 25.1.1 78.1.1 8.2.3 0.45.1 ubuntu_26_04 2031-05-29 3.14.4 25.1.1 78.1.1 8.2.3 0.46.3 fedora_44 2027-06-02 3.14.7 26.0.1 80.10.2 8.2.3 0.45.1 macports -- 3.14.7 26.0.1 80.10.2 9.1.0 0.48.0 alpine_3_22 2027-05-01 3.12.14 25.1.1 80.9.0 8.2.3 0.46.3 alpine_3_23 2027-11-01 3.12.14 25.1.1 80.9.0 8.2.3 0.46.3 openbsd -- 3.14.6 26.2.1 80.9.0 9.1.0 0.48.0 alpine_3_24 2028-06-01 3.14.7 26.1.2 82.0.1 9.1.0 0.47.0 pkgsrc_current -- 3.13.15 26.2.1 84.0.0 9.1.0 0.48.0 CentOS stream 9 note: python3.12, python3.12-pip, python3.12-setuptools and python3.12-wheel are available as optional packages in the standard repository. Sphinx is not available, but can be side-loaded from PyPI using pip3.12. More cleanups to follow: we may have the chance to upgrade to pyproject.toml packaging once and for all now that FreeBSD has moved to Python3.12, which will get us off the legacy packaging we've been using. This isn't a problem *currently*, but it has been the cause of a lot of pain in the past, and the sooner we can ditch it the better. toodles, --js John Snow (12): tests: re-add opencv2 and numpy dependencies tests: add Python3.12 to centos9.docker tests: update emsdk-wasm64-cross qapi: update type hint for types_seen python: upgrade to Python3.12+ python: fix license configuration python: allow mypy to run as the current python version python: remove distutils workarounds python: remove stale setup.cfg options sphinx: require sphinx 7.2.6 sphinx: drop fakedbusdoc sphinx: drop qapidoc back-compat overboiled spaghetti dinner docs/conf.py | 11 +- docs/interop/dbus-display.rst | 14 +- docs/interop/dbus-vmstate.rst | 14 +- docs/interop/dbus-vnc.rst | 14 +- docs/sphinx/compat.py | 230 ------------------ docs/sphinx/fakedbusdoc.py | 30 --- docs/sphinx/qapi_domain.py | 47 ++-- configure | 11 +- tests/docker/dockerfiles/alpine.docker | 1 + tests/docker/dockerfiles/centos9.docker | 14 +- .../dockerfiles/debian-amd64-cross.docker | 2 + .../dockerfiles/debian-arm64-cross.docker | 2 + .../dockerfiles/debian-armhf-cross.docker | 2 + .../dockerfiles/debian-i686-cross.docker | 2 + .../dockerfiles/debian-ppc64el-cross.docker | 2 + .../dockerfiles/debian-riscv64-cross.docker | 2 + .../dockerfiles/debian-s390x-cross.docker | 2 + tests/docker/dockerfiles/debian.docker | 2 + .../dockerfiles/emsdk-wasm64-cross.docker | 4 +- .../dockerfiles/fedora-rust-nightly.docker | 2 + .../dockerfiles/fedora-win64-cross.docker | 2 + tests/docker/dockerfiles/fedora.docker | 2 + tests/docker/dockerfiles/opensuse-leap.docker | 2 + tests/docker/dockerfiles/ubuntu2404.docker | 2 + .gitlab-ci.d/macos-14.vars | 2 +- python/Makefile | 10 +- python/scripts/mkvenv.py | 58 +---- python/setup.cfg | 33 +-- python/tests/linters.py | 11 - python/tests/minreqs.txt | 66 ++--- pythondeps.toml | 13 +- .../ci/setup/debian/debian-13-ppc64le.yaml | 2 + .../ci/setup/ubuntu/ubuntu-2404-aarch64.yaml | 2 + .../ci/setup/ubuntu/ubuntu-2404-s390x.yaml | 2 + scripts/qapi/types.py | 2 +- tests/lcitool/mappings.yml | 24 +- tests/lcitool/projects/qemu.yml | 2 + tests/lcitool/targets/centos-stream-9.yml | 4 +- tests/vm/generated/freebsd.json | 2 + 39 files changed, 156 insertions(+), 493 deletions(-) delete mode 100644 docs/sphinx/compat.py delete mode 100644 docs/sphinx/fakedbusdoc.py -- 2.55.0