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>
-- 
Regards,

Charalampos Stratakis
Senior Software Engineer
Python Maintenance Team, Red Hat
-- 
_______________________________________________
python-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/[email protected]
Do not reply to spam, report it: 
https://forge.fedoraproject.org/infra/tickets/issues/new

Reply via email to