Python: Further clarify python3-devel build requires section #1565

Merged
churchyard merged 1 commit from tadej/packaging-guidelines:python-clarify-buildrequires into main 2026-09-07 10:56:30 +00:00
Member

Ensure the readers quickly and clearly see that they need to use either %pyproject_buildrequires in the %generate_buildrequires section or an ordinary BuildRequires on python3-devel (and not both).

I tripped on this myself when reading the guidelines (too) quickly and @music pointed out in a package review that I should only use one of these and not both.

Ensure the readers quickly and clearly see that they need to use either `%pyproject_buildrequires` in the `%generate_buildrequires` section or an ordinary `BuildRequires` on `python3-devel` (and not both). I tripped on this myself when reading the guidelines (too) quickly and @music pointed out in a [package review](https://bugzilla.redhat.com/show_bug.cgi?id=2487448#c2) that I should only use one of these and not both.
Ensure the readers quickly and clearly see that they need to use either
%pyproject_buildrequires in the %generate_buildrequires section or an
ordinary BuildRequires on python3-devel (and not both).
Member

I would note that combining BuildRequires: python3-devel with %pyproject_buildrequires is not wrong, just unnecessary, since %pyproject_buildrequires takes care of everything. See also https://pagure.io/packaging-committee/pull-request/1379/ and https://pagure.io/packaging-committee/pull-request/1384/.

(In https://pagure.io/packaging-committee/pull-request/1384/#comment-207461, @churchyard wrote “Once we write guidelines for the declarative pyproject BuildSystem, we can list that as a third option.” That was three years ago. It remains officially provisional, but has seen quite bit of testing. I wonder if it’s nearly time to “stabilize” it.)

I would note that combining `BuildRequires: python3-devel` with `%pyproject_buildrequires` is not *wrong*, just *unnecessary*, since `%pyproject_buildrequires` takes care of everything. See also https://pagure.io/packaging-committee/pull-request/1379/ and https://pagure.io/packaging-committee/pull-request/1384/. (In https://pagure.io/packaging-committee/pull-request/1384/#comment-207461, @churchyard wrote “Once we write guidelines for the declarative pyproject BuildSystem, we can list that as a third option.” That was three years ago. It remains officially provisional, but has seen quite bit of testing. I wonder if it’s nearly time to “stabilize” it.)
Owner

I don't consider using both wrong at all. Maybe it could be more obvious that they are not necessary at the same time, but I'd rather not make it sound like you have to choose. No idea how to put that into fewer words.

I don't consider using both wrong at all. Maybe it could be more obvious that they are not necessary at the same time, but I'd rather not make it sound like you have to choose. No idea how to put that into fewer words.
Owner

Let's open up a discussion about whether the pyproject BuildSystem should be stabilized on the python devel list?

Let's open up a discussion about whether the pyproject BuildSystem should be stabilized on the python devel list?
Author
Member

@music wrote in #1565 (comment):

I would note that combining BuildRequires: python3-devel with %pyproject_buildrequires is not wrong, just unnecessary, since %pyproject_buildrequires takes care of everything.

@churchyard wrote in #1565 (comment):

I don't consider using both wrong at all. Maybe it could be more obvious that they are not necessary at the same time, but I'd rather not make it sound like you have to choose. No idea how to put that into fewer words.

Yes, understood. As it is written now, it might (mis)lead someone to just add both to their (new) SPEC file.

What about something like the following?

Every package that uses Python (at run-time and/or build-time) and/or installs Python modules MUST have a build-time dependency on python3-devel, even if Python is not actually invoked during build-time.

If a package uses %pyproject_buildrequires in the %generate_buildrequires section, this will add the python3-devel build requires automatically.
Otherwise, a package must include BuildRequires: python3-devel in its .spec file.

@music wrote in https://forge.fedoraproject.org/packaging/guidelines/pulls/1565#issuecomment-1347740: > I would note that combining `BuildRequires: python3-devel` with `%pyproject_buildrequires` is not _wrong_, just _unnecessary_, since `%pyproject_buildrequires` takes care of everything. @churchyard wrote in https://forge.fedoraproject.org/packaging/guidelines/pulls/1565#issuecomment-1349337: > I don't consider using both wrong at all. Maybe it could be more obvious that they are not necessary at the same time, but I'd rather not make it sound like you have to choose. No idea how to put that into fewer words. Yes, understood. As it is written now, it might (mis)lead someone to just add both to their (new) SPEC file. What about something like the following? **Every** package that uses Python (at run-time and/or build-time) and/or installs Python modules **MUST** have a build-time dependency on `python3-devel`, even if Python is not actually invoked during build-time. If a package uses `%pyproject_buildrequires` in the `%generate_buildrequires` section, this will add the `python3-devel` build requires automatically. Otherwise, a package must include `BuildRequires: python3-devel` in its `.spec` file.
Owner

I like that.

I like that.
tadej force-pushed python-clarify-buildrequires from 6dbb871e5f to c16b6802bd 2026-08-27 09:41:35 +00:00 Compare
tadej changed title from Python: Improve python3-devel build requires section with explicit OR to Python: Further clarify python3-devel build requires section 2026-08-27 09:42:50 +00:00
Author
Member

@churchyard wrote in #1565 (comment):

I like that.

I've amended the commit to include the new variant.

@churchyard wrote in https://forge.fedoraproject.org/packaging/guidelines/pulls/1565#issuecomment-1349624: > I like that. I've amended the commit to include the new variant.
churchyard approved these changes 2026-09-07 10:55:37 +00:00
Owner

Since this is not a new rule but a clarification, and it was more or less also acked on the FPC Matrix meeting, I'm merging it.

Since this is not a new rule but a clarification, and it was more or less also acked on the FPC Matrix meeting, I'm merging it.
Owner

Thanks, @tadej

Thanks, @tadej
Author
Member

Thanks, @churchyard!

Thanks, @churchyard!
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
packaging/guidelines!1565
No description provided.