Bug 2463187

Summary: Typical use of %pyproject_patch_dependency requires explicit BR on python3-devel or pyproject-rpm-macros
Product: [Fedora] Fedora Reporter: Ben Beasley <code>
Component: pyproject-rpm-macrosAssignee: Miro Hrončok <mhroncok>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: cstratak, maxwell, mhroncok, python-packagers-sig
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pyproject-rpm-macros-1.20.1-1.fc45 pyproject-rpm-macros-1.21.0-1.fc43 pyproject-rpm-macros-1.21.0-1.fc44 pyproject-rpm-macros-1.22.1-1.fc42 Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2026-04-28 14:59:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ben Beasley 2026-04-27 11:09:16 UTC
Typical use of the new provisional %pyproject_patch_dependency macro requires an explicit, manual

  BuildRequires:  python3-devel

or at least

  BuildRequires:  pyproject-rpm-macros

so that the macro will be defined in the %prep section.

See https://src.fedoraproject.org/rpms/bidscoin/pull-request/1#request_diff for an example.

We’ve been moving in the direction of advising that people shouldn’t feel the need for this kind of manual BR when BuildSystem: pyproject or %pyproject_buildrequires are in use, but this might push things back in the opposite direction if %pyproject_patch_dependency sees wide adoption.

I mentioned this on Matrix, and Miro Hrončok wrote, “Also, BuildRequires: python3-devel will not be good enough on EL,” which is a good point. He also wrote, “we should move %pyproject_patch_dependency to srpm macros. it's implementation is oneliner (ok, 4 lines).”

It does look like some macros would also be need to be migrated to the srpm macros in order to figure out where to write the dependency override file, though:

  # This is a backward-compatible suffix used in all pyproject-rpm-macros directories
  # For the main Python it's empty, for all others it's "-3.X"
  %_pyproject_files_pkgversion %{expr:"%{python3_pkgversion}" != "3" ? "-%{python3_pkgversion}" : ""}
  
  # We prefix all created files with this value to make them unique
  # Ideally, we would put them into %%{buildsubdir}, but that value changes during the spec
  # The used value is similar to the one used to define the default %%buildroot
  %_pyproject_files_prefix %{name}-%{version}-%{release}.%{_arch}%{_pyproject_files_pkgversion}
  
  %_pyproject_dep_overrides %{_builddir}/%{_pyproject_files_prefix}-pyproject-dep-overrides

  %pyproject_patch_dependency() %{expand:\\\
  %{!?1:%{error:%%pyproject_patch_dependency requires an argument}}\\\
  %{?2:%{error:%%pyproject_patch_dependency accepts exactly one argument per call}}\\\
  echo '%1' >> %{_pyproject_dep_overrides}
  }

Does this make sense? And is there a reasonable alternative?

Comment 1 Miro Hrončok 2026-04-27 11:19:51 UTC
Even with more lines to move, I think it's OK. No Python files, no external dependency needs to be added to the SRPM package. The size of the file is still effectivelly 4K.

Comment 2 Ben Beasley 2026-04-27 11:28:49 UTC
(In reply to Miro Hrončok from comment #1)
> Even with more lines to move, I think it's OK. No Python files, no external
> dependency needs to be added to the SRPM package. The size of the file is
> still effectivelly 4K.

Can we rely on macros from pyproject-srpm-macros (macros.aaa-pyproject-srpm) in pyproject-rpm-macros (macros.pyproject), or do the definitions need to be duplicated in both places? Considering that pyproject-rpm-macros does not depend on its pyproject-srpm-macros subpackage, only enforce a version constraint if it is installed

  Requires:       (pyproject-srpm-macros = %{?epoch:%{epoch}:}%{version}-%{release} if pyproject-srpm-macros)

it looks like the latter to me, but perhaps I am missing something.

Comment 3 Ben Beasley 2026-04-27 11:30:37 UTC
(In reply to Ben Beasley from comment #0)
> Typical use of the new provisional %pyproject_patch_metadata macro requires

This was a typo for %pyproject_patch_dependency. I’ve corrected the bug title as well.

Comment 4 Miro Hrončok 2026-04-27 11:48:57 UTC
I think it's better to make that a real Requires rather than duplicating the definition. Effectively, it will be installed anyway, so no need to play the if dance.

Comment 6 Fedora Update System 2026-04-28 14:55:06 UTC
FEDORA-2026-daceb87a93 (pyproject-rpm-macros-1.20.1-1.fc45) has been submitted as an update to Fedora 45.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-daceb87a93

Comment 7 Fedora Update System 2026-04-28 14:59:55 UTC
FEDORA-2026-daceb87a93 (pyproject-rpm-macros-1.20.1-1.fc45) has been pushed to the Fedora 45 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 8 Fedora Update System 2026-04-28 15:26:30 UTC
FEDORA-2026-051d1b3285 (pyproject-rpm-macros-1.20.1-1.fc43) has been submitted as an update to Fedora 43.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-051d1b3285

Comment 9 Fedora Update System 2026-04-28 15:26:44 UTC
FEDORA-2026-c50219cb79 (pyproject-rpm-macros-1.20.1-1.fc44) has been submitted as an update to Fedora 44.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-c50219cb79

Comment 10 Fedora Update System 2026-04-28 15:27:14 UTC
FEDORA-2026-b365003f50 (pyproject-rpm-macros-1.20.1-1.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-b365003f50

Comment 11 Fedora Update System 2026-04-29 03:11:53 UTC
FEDORA-2026-051d1b3285 has been pushed to the Fedora 43 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-051d1b3285`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-051d1b3285

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 12 Fedora Update System 2026-04-29 03:35:15 UTC
FEDORA-2026-b365003f50 has been pushed to the Fedora 42 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-b365003f50`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-b365003f50

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 13 Fedora Update System 2026-04-29 18:48:31 UTC
FEDORA-2026-c50219cb79 has been pushed to the Fedora 44 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-c50219cb79`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-c50219cb79

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 14 Fedora Update System 2026-04-30 02:15:48 UTC
FEDORA-2026-f83c29a149 has been pushed to the Fedora 43 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-f83c29a149`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-f83c29a149

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 15 Fedora Update System 2026-04-30 02:49:46 UTC
FEDORA-2026-0a10b4d589 has been pushed to the Fedora 42 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-0a10b4d589`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-0a10b4d589

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 16 Fedora Update System 2026-05-01 03:05:58 UTC
FEDORA-2026-f83c29a149 (pyproject-rpm-macros-1.21.0-1.fc43) has been pushed to the Fedora 43 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 17 Fedora Update System 2026-05-02 02:11:42 UTC
FEDORA-2026-df48a8f3e0 (pyproject-rpm-macros-1.21.0-1.fc44) has been pushed to the Fedora 44 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 18 Fedora Update System 2026-05-08 02:28:33 UTC
FEDORA-2026-aefbbc6b17 has been pushed to the Fedora 42 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-aefbbc6b17`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-aefbbc6b17

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 19 Fedora Update System 2026-05-09 01:03:00 UTC
FEDORA-2026-aefbbc6b17 has been pushed to the Fedora 42 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-aefbbc6b17`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-aefbbc6b17

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 20 Fedora Update System 2026-05-24 01:10:46 UTC
FEDORA-2026-aefbbc6b17 (pyproject-rpm-macros-1.22.1-1.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.