Moving from PEP 610 usage guidelines for Linux distributions.
This thread is intended to be used as a canonical location to point users to when asked about building a RPM package without a
Traditionally, Python packages are built as a RPM package by running
setup.py. The Python packaging community, however, is steadily moving away from relying on setuptools as a first-order tool, promoting instead to use wheels as the primary exchange artifact format, and PEP 517 as a way to build them. This enables Python projects to use alternative packaging tools while maintaining interoperability of their artifacts, and there is a visible trend for Python projects to not include a
setup.py as a result. (See: Which mainstream projects removed setup.py files?) And even for a setuptools-based project, the recommendation is still to build a wheel using setuptools’s PEP 517 hooks, instead of invoking
Building for RPM
Meanwhile, however, RPM packaging tools are still catching up to this new trend. Fedora’s official guidelines, for example, still instructs using
setup.py directly. Developer from Fedora are working on a provisional implementation, pyproject-rpm-macros, to provide tooling to build a PEP 517 project using the
pyproject.toml build tool definition, as specified in PEP 518. This provides a solution to build a RPM package from a Python project that does not contain a
setup.py, and also a migration path to move off invoking
setup.py directly if a Python project has declared itself as using PEP 517, to better ensure the resulting RPM package has the same behaviour as the Python package installed as a wheel.