The way for building python 3 modules currently

Arkadiusz Miśkiewicz arekm at maven.pl
Fri Feb 7 14:48:36 CET 2025


What's "the way" for building python3 modules for rpm usage currently?

setup.py is obsolete and all our macros use setup.py



I've started using:

%build
%{__python3} -m build --wheel --no-isolation --outdir build-3

%install
%{__python3} -m installer --destdir=$RPM_BUILD_ROOT build-3/*.whl

and it seems to be working but fedora for example uses different way via 
pip like in build_wheel() at
https://src.fedoraproject.org/rpms/pyproject-rpm-macros/blob/rawhide/f/pyproject_wheel.py

then %pyproject_install to install files 
https://src.fedoraproject.org/rpms/pyproject-rpm-macros/blob/rawhide/f/macros.pyproject

and finally
https://src.fedoraproject.org/rpms/pyproject-rpm-macros/blob/rawhide/f/pyproject_save_files.py
to generate list of rpm spec files for usage in %files -f XYZ

Example usage of their macros:
https://src.fedoraproject.org/rpms/python-installer/blob/rawhide/f/python-installer.spec


What way makes sense for us?


Looks like there are tons of tools and ways to build python packages now 
and above are just two examples :-/

Debian uses some pybuild tool:
https://salsa.debian.org/python-team/tools/dh-python/-/blob/master/pybuild.rst

Archlinux uses -m build/installer:
https://wiki.archlinux.org/title/Python_package_guidelines

Others - no idea.

-- 
Arkadiusz Miśkiewicz, arekm / ( maven.pl | pld-linux.org )



More information about the pld-devel-en mailing list