From: John Snow <jsnow@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Joel Stanley" <joel@jms.id.au>, "Yi Liu" <yi.l.liu@intel.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Helge Deller" <deller@gmx.de>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Andrew Jeffery" <andrew@codeconstruct.com.au>,
"Fabiano Rosas" <farosas@suse.de>,
"Alexander Bulekov" <alxndr@bu.edu>,
"Darren Kenny" <darren.kenny@oracle.com>,
"Leif Lindholm" <leif.lindholm@oss.qualcomm.com>,
"Cédric Le Goater" <clg@kaod.org>,
"Ed Maste" <emaste@freebsd.org>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Warner Losh" <imp@bsdimp.com>, "Kevin Wolf" <kwolf@redhat.com>,
"Tyrone Ting" <kfting@nuvoton.com>,
"Eric Blake" <eblake@redhat.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Yoshinori Sato" <ysato@users.sourceforge.jp>,
"Troy Lee" <leetroy@gmail.com>,
"Halil Pasic" <pasic@linux.ibm.com>,
"Akihiko Odaki" <odaki@rsg.ci.i.u-tokyo.ac.jp>,
"Michael Roth" <michael.roth@amd.com>,
"Laurent Vivier" <laurent@vivier.eu>,
"Ani Sinha" <anisinha@redhat.com>,
"Weiwei Li" <liwei1518@gmail.com>, "John Snow" <jsnow@redhat.com>,
"Eric Farman" <farman@linux.ibm.com>,
"Steven Lee" <steven_lee@aspeedtech.com>,
"Brian Cain" <brian.cain@oss.qualcomm.com>,
"Li-Wen Hsu" <lwhsu@freebsd.org>,
"Jamin Lin" <jamin_lin@aspeedtech.com>,
qemu-s390x@nongnu.org,
"Vladimir Sementsov-Ogievskiy" <vsementsov@yandex-team.ru>,
qemu-block@nongnu.org, "Bernhard Beschow" <shentey@gmail.com>,
"Clément Mathieu--Drif" <clement.mathieu--drif@eviden.com>,
"Maksim Davydov" <davydov-max@yandex-team.ru>,
"Niek Linnenbank" <nieklinnenbank@gmail.com>,
"Hervé Poussineau" <hpoussin@reactos.org>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
"Paul Durrant" <paul@xen.org>,
"Manos Pitsidianakis" <manos.pitsidianakis@linaro.org>,
"Jagannathan Raman" <jag.raman@oracle.com>,
"Igor Mitsyanko" <i.mitsyanko@gmail.com>,
"Max Filippov" <jcmvbkbc@gmail.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Anton Johansson" <anjo@rev.ng>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Cleber Rosa" <crosa@redhat.com>,
"Eric Auger" <eric.auger@redhat.com>,
"Yanan Wang" <wangyanan55@huawei.com>,
qemu-arm@nongnu.org, "Hao Wu" <wuhaotsh@google.com>,
"Mads Ynddal" <mads@ynddal.dk>,
"Sriram Yagnaraman" <sriram.yagnaraman@ericsson.com>,
qemu-riscv@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Michael Rolnik" <mrolnik@gmail.com>,
"Zhao Liu" <zhao1.liu@intel.com>,
"Alessandro Di Federico" <ale@rev.ng>,
"Thomas Huth" <thuth@redhat.com>,
"Antony Pavlov" <antonynpavlov@gmail.com>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
"Hanna Reitz" <hreitz@redhat.com>,
"Ilya Leoshkevich" <iii@linux.ibm.com>,
"Marcelo Tosatti" <mtosatti@redhat.com>,
"Nina Schoetterl-Glausch" <nsg@linux.ibm.com>,
"Daniel Henrique Barboza" <danielhb413@gmail.com>,
"Qiuhao Li" <Qiuhao.Li@outlook.com>,
"Hyman Huang" <yong.huang@smartx.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Magnus Damm" <magnus.damm@gmail.com>,
qemu-rust@nongnu.org, "Bandan Das" <bsd@redhat.com>,
"Strahinja Jankovic" <strahinja.p.jankovic@gmail.com>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
kvm@vger.kernel.org, "Fam Zheng" <fam@euphon.net>,
"Jia Liu" <proljc@gmail.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Alistair Francis" <alistair@alistair23.me>,
"Subbaraya Sundeep" <sundeep.lkml@gmail.com>,
"Kyle Evans" <kevans@freebsd.org>,
"Song Gao" <gaosong@loongson.cn>,
"Alexandre Iooss" <erdnaxe@crans.org>,
"Aurelien Jarno" <aurelien@aurel32.net>,
"Liu Zhiwei" <zhiwei_liu@linux.alibaba.com>,
"Peter Xu" <peterx@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"BALATON Zoltan" <balaton@eik.bme.hu>,
"Elena Ufimtseva" <elena.ufimtseva@oracle.com>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Frédéric Barrat" <fbarrat@linux.ibm.com>,
qemu-ppc@nongnu.org, "Radoslaw Biernacki" <rad@semihalf.com>,
"Beniamino Galvani" <b.galvani@gmail.com>,
"David Hildenbrand" <david@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"David Woodhouse" <dwmw2@infradead.org>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Ahmed Karaman" <ahmedkhaledkaraman@gmail.com>,
"Huacai Chen" <chenhuacai@kernel.org>,
"Mahmoud Mandour" <ma.mandourr@gmail.com>,
"Harsh Prateek Bora" <harshpb@linux.ibm.com>
Subject: [PATCH v2 01/12] python: convert packages to PEP517/pyproject.toml
Date: Thu, 12 Jun 2025 16:54:39 -0400 [thread overview]
Message-ID: <20250612205451.1177751-2-jsnow@redhat.com> (raw)
In-Reply-To: <20250612205451.1177751-1-jsnow@redhat.com>
Newer versions of setuptools increasingly expect that packages are
defined using the pyproject.toml/PEP517 packaging layout format. With
3.9 as our minimum, I believe it's finally appropriate to make the shift
away from the legacy packaging format.
Update documentation and dependencies that change as a result of the
different build/packaging/installation pathways.
This change has the effect of fixing "make check-dev", which has been
broken on newer versions of Fedora for a while, now.
Signed-off-by: John Snow <jsnow@redhat.com>
---
python/README.rst | 33 ++++++++++++++++-----------------
python/Makefile | 18 +++++++++---------
python/pyproject.toml | 10 ++++++++++
python/setup.py | 40 ----------------------------------------
python/tests/minreqs.txt | 2 +-
5 files changed, 36 insertions(+), 67 deletions(-)
create mode 100644 python/pyproject.toml
delete mode 100755 python/setup.py
diff --git a/python/README.rst b/python/README.rst
index d62e71528d2..befa84e3261 100644
--- a/python/README.rst
+++ b/python/README.rst
@@ -5,24 +5,23 @@ This directory houses Python tooling used by the QEMU project to build,
configure, and test QEMU. It is organized by namespace (``qemu``), and
then by package (e.g. ``qemu/machine``, ``qemu/qmp``, etc).
-``setup.py`` is used by ``pip`` to install this tooling to the current
-environment. ``setup.cfg`` provides the packaging configuration used by
-``setup.py``. You will generally invoke it by doing one of the following:
+``pyproject.toml`` and ``setup.cfg`` are used by ``pip`` to install this
+tooling to the current environment. ``setup.cfg`` provides the packaging
+configuration, while ``pyproject.toml`` describes the package build
+system requirements.
-1. ``pip3 install .`` will install these packages to your current
- environment. If you are inside a virtual environment, they will
- install there. If you are not, it will attempt to install to the
- global environment, which is **not recommended**.
+You will generally install these packages by invoking ``pip3 install
+.``; which will install these packages to your current environment. If
+you are inside a virtual environment, they will install there. If you
+are not, modern versions of pip will attempt instead to install to your
+local user environment. Older versions of pip will attempt to install to
+the global environment, which is **not recommended**.
-2. ``pip3 install --user .`` will install these packages to your user's
- local python packages. If you are inside of a virtual environment,
- this will fail; you want the first invocation above.
-
-If you append the ``--editable`` or ``-e`` argument to either invocation
-above, pip will install in "editable" mode. This installs the package as
-a forwarder ("qemu.egg-link") that points to the source tree. In so
-doing, the installed package always reflects the latest version in your
-source tree.
+If you append the ``--editable`` or ``-e`` argument to the above
+invocation, pip will install in "editable" mode. This installs the
+package as a "forwarder" that points to the source tree, so that the
+installed package always reflects the latest version in your source
+tree.
Installing ".[devel]" instead of "." will additionally pull in required
packages for testing this package. They are not runtime requirements,
@@ -81,4 +80,4 @@ Files in this directory
- ``VERSION`` contains the PEP-440 compliant version used to describe
this package; it is referenced by ``setup.cfg``.
- ``setup.cfg`` houses setuptools package configuration.
-- ``setup.py`` is the setuptools installer used by pip; See above.
+- ``pyproject.toml`` lists build system requirements for the Python packages.
diff --git a/python/Makefile b/python/Makefile
index 764b79ccb23..845fbb66cf4 100644
--- a/python/Makefile
+++ b/python/Makefile
@@ -15,8 +15,8 @@ help:
@echo "make check-tox:"
@echo " Run tests against multiple python versions."
@echo " These tests use the newest dependencies."
- @echo " Requires: Python 3.9 - 3.11, and tox."
- @echo " Hint (Fedora): 'sudo dnf install python3-tox python3.11'"
+ @echo " Requires: Python 3.9 - 3.13, and tox."
+ @echo " Hint (Fedora): 'sudo dnf install python3-tox python3.13'"
@echo " The variable QEMU_TOX_EXTRA_ARGS can be use to pass extra"
@echo " arguments to tox".
@echo ""
@@ -63,12 +63,12 @@ $(QEMU_MINVENV_DIR) $(QEMU_MINVENV_DIR)/bin/activate: setup.cfg tests/minreqs.tx
@( \
echo "ACTIVATE $(QEMU_MINVENV_DIR)"; \
. $(QEMU_MINVENV_DIR)/bin/activate; \
- echo "INSTALL wheel $(QEMU_MINVENV_DIR)"; \
- $(PIP_INSTALL) wheel 1>/dev/null; \
+ echo "INSTALL wheel $(QEMU_MINVENV_DIR)"; \
+ $(PIP_INSTALL) wheel 1>/dev/null; \
echo "INSTALL -r tests/minreqs.txt $(QEMU_MINVENV_DIR)";\
$(PIP_INSTALL) -r tests/minreqs.txt 1>/dev/null; \
echo "INSTALL -e qemu $(QEMU_MINVENV_DIR)"; \
- $(PIP_INSTALL) -e . 1>/dev/null; \
+ $(PIP_INSTALL) -e . --config-settings=editable_mode=compat 1>/dev/null; \
)
@touch $(QEMU_MINVENV_DIR)
@@ -103,7 +103,7 @@ check-dev: dev-venv
.PHONY: develop
develop:
- $(PIP_INSTALL) -e .[devel]
+ $(PIP_INSTALL) -e .[devel] --config-settings=editable_mode=compat
.PHONY: check
check:
@@ -122,12 +122,12 @@ check-coverage:
.PHONY: clean
clean:
- python3 setup.py clean --all
- rm -f pyproject.toml
+ rm -rf build/
.PHONY: distclean
distclean: clean
- rm -rf qemu.egg-info/ .eggs/ dist/
+ rm -rf qemu.egg-info/
rm -rf $(QEMU_VENV_DIR) $(QEMU_MINVENV_DIR) .tox/
+ rm -rf .mypy_cache/
rm -f .coverage .coverage.*
rm -rf htmlcov/
diff --git a/python/pyproject.toml b/python/pyproject.toml
new file mode 100644
index 00000000000..2de34bf4729
--- /dev/null
+++ b/python/pyproject.toml
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+[build-system]
+requires = [
+ "setuptools>=39.2",
+ "wheel",
+]
+build-backend = "setuptools.build_meta"
+
+[tool.setuptools_scm]
diff --git a/python/setup.py b/python/setup.py
deleted file mode 100755
index c5bc45919a4..00000000000
--- a/python/setup.py
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/env python3
-"""
-QEMU tooling installer script
-Copyright (c) 2020-2021 John Snow for Red Hat, Inc.
-"""
-
-import setuptools
-from setuptools.command import bdist_egg
-import sys
-import pkg_resources
-
-
-class bdist_egg_guard(bdist_egg.bdist_egg):
- """
- Protect against bdist_egg from being executed
-
- This prevents calling 'setup.py install' directly, as the 'install'
- CLI option will invoke the deprecated bdist_egg hook. "pip install"
- calls the more modern bdist_wheel hook, which is what we want.
- """
- def run(self):
- sys.exit(
- 'Installation directly via setup.py is not supported.\n'
- 'Please use `pip install .` instead.'
- )
-
-
-def main():
- """
- QEMU tooling installer
- """
-
- # https://medium.com/@daveshawley/safely-using-setup-cfg-for-metadata-1babbe54c108
- pkg_resources.require('setuptools>=39.2')
-
- setuptools.setup(cmdclass={'bdist_egg': bdist_egg_guard})
-
-
-if __name__ == '__main__':
- main()
diff --git a/python/tests/minreqs.txt b/python/tests/minreqs.txt
index cd2e2a81c3d..e9edfa55eb7 100644
--- a/python/tests/minreqs.txt
+++ b/python/tests/minreqs.txt
@@ -15,6 +15,7 @@
# also pin setuptools to version 70 or below. Otherwise, the
# installation of the QEMU package itself fails, failing to find
# setuptools.
+# Avocado also appears to require an older setuptools.
setuptools<=70
# Dependencies for qapidoc/qapi_domain et al
@@ -55,7 +56,6 @@ astroid==2.15.4
dill==0.2
lazy-object-proxy==1.4.0
platformdirs==2.2.0
-toml==0.10.0
tomlkit==0.10.1
wrapt==1.14.0
--
2.48.1
next prev parent reply other threads:[~2025-06-12 20:56 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-12 20:54 [PATCH v2 00/12] Python: Fix 'make check-dev' and modernize to 3.9+ John Snow
2025-06-12 20:54 ` John Snow [this message]
2025-06-13 8:36 ` [PATCH v2 01/12] python: convert packages to PEP517/pyproject.toml Thomas Huth
2025-06-12 20:54 ` [PATCH v2 02/12] python: update pylint ignores John Snow
2025-06-13 10:18 ` Thomas Huth
2025-06-16 12:05 ` Akihiko Odaki
2025-06-12 20:54 ` [PATCH v2 03/12] python: sync changes from external qemu.qmp package John Snow
2025-06-16 12:12 ` Akihiko Odaki
2025-06-12 20:54 ` [PATCH v2 04/12] python: update shebangs to standard, using /usr/bin/env John Snow
2025-06-13 10:39 ` Thomas Huth
2025-06-16 12:12 ` Akihiko Odaki
2025-06-12 20:54 ` [PATCH v2 05/12] python: fix illegal escape sequences John Snow
2025-06-13 10:41 ` Thomas Huth
2025-06-16 12:13 ` Akihiko Odaki
2025-06-12 20:54 ` [PATCH v2 06/12] python: upgrade to python3.9+ syntax John Snow
2025-06-17 9:15 ` Mads Ynddal
2025-06-24 7:34 ` Markus Armbruster
[not found] ` <CAFn=p-YPN6MWZiETi7XWkyYVPpe7uew49CwjEdAsMmW=ZPOx5A@mail.gmail.com>
2025-06-26 4:54 ` Markus Armbruster
2025-06-12 20:54 ` [PATCH v2 07/12] fixup John Snow
2025-06-12 20:54 ` [PATCH v2 08/12] python: further 3.9+ syntax upgrades John Snow
2025-06-12 20:54 ` [PATCH v2 09/12] python: update mkvenv to type-check under different python versions John Snow
2025-06-12 20:54 ` [PATCH v2 10/12] python: remove version restriction for mypy John Snow
2025-06-12 20:54 ` [PATCH v2 11/12] scripts/codeconverter: remove unused code John Snow
2025-06-12 20:54 ` [PATCH v2 12/12] scripts/codeconverter: remove * imports John Snow
2025-06-16 8:53 ` [PATCH v2 00/12] Python: Fix 'make check-dev' and modernize to 3.9+ Akihiko Odaki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250612205451.1177751-2-jsnow@redhat.com \
--to=jsnow@redhat.com \
--cc=Qiuhao.Li@outlook.com \
--cc=ahmedkhaledkaraman@gmail.com \
--cc=ale@rev.ng \
--cc=alex.bennee@linaro.org \
--cc=alistair@alistair23.me \
--cc=alxndr@bu.edu \
--cc=andrew@codeconstruct.com.au \
--cc=anisinha@redhat.com \
--cc=anjo@rev.ng \
--cc=antonynpavlov@gmail.com \
--cc=armbru@redhat.com \
--cc=aurelien@aurel32.net \
--cc=b.galvani@gmail.com \
--cc=balaton@eik.bme.hu \
--cc=berrange@redhat.com \
--cc=borntraeger@linux.ibm.com \
--cc=brian.cain@oss.qualcomm.com \
--cc=bsd@redhat.com \
--cc=chenhuacai@kernel.org \
--cc=clement.mathieu--drif@eviden.com \
--cc=clg@kaod.org \
--cc=crosa@redhat.com \
--cc=danielhb413@gmail.com \
--cc=darren.kenny@oracle.com \
--cc=david@redhat.com \
--cc=davydov-max@yandex-team.ru \
--cc=deller@gmx.de \
--cc=dwmw2@infradead.org \
--cc=eblake@redhat.com \
--cc=edgar.iglesias@gmail.com \
--cc=eduardo@habkost.net \
--cc=elena.ufimtseva@oracle.com \
--cc=emaste@freebsd.org \
--cc=erdnaxe@crans.org \
--cc=eric.auger@redhat.com \
--cc=fam@euphon.net \
--cc=farman@linux.ibm.com \
--cc=farosas@suse.de \
--cc=fbarrat@linux.ibm.com \
--cc=gaosong@loongson.cn \
--cc=harshpb@linux.ibm.com \
--cc=hpoussin@reactos.org \
--cc=hreitz@redhat.com \
--cc=i.mitsyanko@gmail.com \
--cc=iii@linux.ibm.com \
--cc=imp@bsdimp.com \
--cc=jag.raman@oracle.com \
--cc=jamin_lin@aspeedtech.com \
--cc=jasowang@redhat.com \
--cc=jcmvbkbc@gmail.com \
--cc=jiaxun.yang@flygoat.com \
--cc=joel@jms.id.au \
--cc=kevans@freebsd.org \
--cc=kfting@nuvoton.com \
--cc=kraxel@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kwolf@redhat.com \
--cc=laurent@vivier.eu \
--cc=leetroy@gmail.com \
--cc=leif.lindholm@oss.qualcomm.com \
--cc=liwei1518@gmail.com \
--cc=lwhsu@freebsd.org \
--cc=ma.mandourr@gmail.com \
--cc=mads@ynddal.dk \
--cc=magnus.damm@gmail.com \
--cc=manos.pitsidianakis@linaro.org \
--cc=marcandre.lureau@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=michael.roth@amd.com \
--cc=mrolnik@gmail.com \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.com \
--cc=nieklinnenbank@gmail.com \
--cc=npiggin@gmail.com \
--cc=nsg@linux.ibm.com \
--cc=odaki@rsg.ci.i.u-tokyo.ac.jp \
--cc=palmer@dabbelt.com \
--cc=pasic@linux.ibm.com \
--cc=paul@xen.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=pierrick.bouvier@linaro.org \
--cc=proljc@gmail.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=qemu-rust@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=rad@semihalf.com \
--cc=richard.henderson@linaro.org \
--cc=shentey@gmail.com \
--cc=sriram.yagnaraman@ericsson.com \
--cc=stefanha@redhat.com \
--cc=steven_lee@aspeedtech.com \
--cc=strahinja.p.jankovic@gmail.com \
--cc=sundeep.lkml@gmail.com \
--cc=thuth@redhat.com \
--cc=vsementsov@yandex-team.ru \
--cc=wangyanan55@huawei.com \
--cc=wuhaotsh@google.com \
--cc=yi.l.liu@intel.com \
--cc=yong.huang@smartx.com \
--cc=ysato@users.sourceforge.jp \
--cc=zhao1.liu@intel.com \
--cc=zhiwei_liu@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).