Hello folks,
Tired of figuring out the right sed or patch to modify dependency constraints in your Python packages? Or having your carefully crafted regex break because upstream reformatted their metadata? %pyproject_patch_dependency is here to help.
A new macro has been merged into pyproject-rpm-macros and is available in Rawhide, F44 and F43 as a provisional feature. It provides a uniform way to override upstream dependency constraints in %prep, regardless of the build backend. It affects both BuildRequires and runtime Requires.
Example usage:
%prep %autosetup -p1 %pyproject_patch_dependency cython:drop_upper %pyproject_patch_dependency numpy:set_upper:3.0 %pyproject_patch_dependency legacy-dep:ignore
It also handles circular/sibling dependencies in multi-wheel specs via the br_only suffix. A sibling package can be ignored in BuildRequires (since it's not yet installed during build) while keeping it as a runtime Requires:
%pyproject_patch_dependency sibling-package:ignore:br_only
The feature is marked provisional, meaning the API may change based on real-world usage. If you maintain Python packages and deal with dependency version overrides, I'd appreciate if you gave this a try and reported any issues.
Documentation (Provisional: Overriding dependency constraints section) https://src.fedoraproject.org/rpms/pyproject-rpm-macros/blob/rawhide/f/README.md https://src.fedoraproject.org/rpms/pyproject-rpm-macros/blob/rawhide/f/README.md Implementation https://src.fedoraproject.org/rpms/pyproject-rpm-macros/c/5d9798f289ea8cbeb5189604013e865e7e7d2870?branch=rawhide
F44 bodhi update https://bodhi.fedoraproject.org/updates/FEDORA-2026-c50219cb79 F43 bodhi update https://bodhi.fedoraproject.org/updates/FEDORA-2026-051d1b3285
On 25. 04. 26 2:46, Charalampos Stratakis via python-devel wrote:
Hello folks,
Tired of figuring out the right sed or patch to modify dependency constraints in your Python packages? Or having your carefully crafted regex break because upstream reformatted their metadata? %pyproject_patch_dependency is here to help.
A new macro has been merged into pyproject-rpm-macros and is available in Rawhide, F44 and F43 as a provisional feature. It provides a uniform way to override upstream dependency constraints in %prep, regardless of the build backend. It affects both BuildRequires and runtime Requires.
Example usage:
%prep %autosetup -p1 %pyproject_patch_dependency cython:drop_upper %pyproject_patch_dependency numpy:set_upper:3.0 %pyproject_patch_dependency legacy-dep:ignore
Hi.
I wonder, now that we have long options available for the %pyproject macros, whether we should update this to work like:
%pyproject_patch_dependency cython --drop-upper %pyproject_patch_dependency numpy --set-upper=3.0 %pyproject_patch_dependency legacy-dep --ignore %pyproject_patch_dependency sibling-package --ignore --br-only
Behind the scenes, this could still work the same way. WDYT?
As it's a provisional feature, I'd rather wait a little bit to see adoption and how it's receive before implementing long option.
On Thu, May 21, 2026 at 11:20 AM Miro Hrončok mhroncok@redhat.com wrote:
On 25. 04. 26 2:46, Charalampos Stratakis via python-devel wrote:
Hello folks,
Tired of figuring out the right sed or patch to modify dependency
constraints
in your Python packages? Or having your carefully crafted regex break
because
upstream reformatted their metadata? %pyproject_patch_dependency is here
to help.
A new macro has been merged into pyproject-rpm-macros and is available
in
Rawhide, F44 and F43 as a provisional feature. It provides a uniform way
to
override upstream dependency constraints in %prep, regardless of the
build
backend. It affects both BuildRequires and runtime Requires.
Example usage:
%prep %autosetup -p1 %pyproject_patch_dependency cython:drop_upper %pyproject_patch_dependency numpy:set_upper:3.0 %pyproject_patch_dependency legacy-dep:ignore
Hi.
I wonder, now that we have long options available for the %pyproject macros, whether we should update this to work like:
%pyproject_patch_dependency cython --drop-upper %pyproject_patch_dependency numpy --set-upper=3.0 %pyproject_patch_dependency legacy-dep --ignore %pyproject_patch_dependency sibling-package --ignore --br-only
Behind the scenes, this could still work the same way. WDYT?
-- Miro Hrončok -- Phone: +420777974800
python-devel@lists.fedoraproject.org