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/READ…>
<https://src.fedoraproject.org/rpms/pyproject-rpm-macros/blob/rawhide/f/READ…>
Implementation
<https://src.fedoraproject.org/rpms/pyproject-rpm-macros/c/5d9798f289ea8cbeb…>
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-scikit-image's pyproject.toml file has a section with:
[build-system]
build-backend = 'mesonpy'
requires = [
'meson-python>=0.16',
'Cython>=3.0.8,!=3.2.0b1',
'pythran>=0.16',
'lazy_loader>=0.4',
'numpy>=2.0',
]
how can I get %pyproject_generatebuildrequires to add those dependencies?
Thanks!
--
Orion Poplawski
he/him/his - surely the least important thing about me
IT Systems Manager 720-772-5637
NWRA, Boulder/CoRA Office FAX: 303-415-9702
3380 Mitchell Lane orion(a)nwra.com
Boulder, CO 80301 https://www.nwra.com/
Hello Pythonistats,
we have been busy at pyproject-rpm-macros, so here's a third enhancement
release in 2 weeks. pyproject-rpm-macros 1.22.0 and it brings in one major and
one minor improvement:
Add long option support for all public parametric macros
========================================================
Now you can use self-explanatory long options:
%pyproject_buildrequires --no-runtime
%pyproject_save_files --assert-license ...
Instead of cryptic short options:
%pyproject_buildrequires -R
%pyproject_save_files -l ...
See the full option set in the README
https://src.fedoraproject.org/rpms/pyproject-rpm-macros/blob/rawhide/f/READ…
Section "Long option support and options reference"
This was previously discussed in
https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproj…
I would like to explicitly thank Maxwell G for a very thorough review with many
great remarks and suggestions.
PS, this also mean %pyproject_save_files accepts --auto (as a more natural
alternative to +auto).
%pyproject_patch_dependency: Validate arguments early, in %prep
===============================================================
When python3 and pyproject-rpm-macros are installed,
the %pyproject_patch_dependency macro now validates the argument in %prep time,
catching invalid overrides immediately instead of in %pyproject_buildrequires.
When only pyproject-srpm-macros is installed, validation is skipped gracefully
(and the error will happen later in the build).
This should shorten the packager feedback loop when experimenting with
%pyproject_patch_dependency (from fedpkg mockbuild to fedpkg prep).
----------------------------------------------------------------------
Anyway, the new version of the package is available in Rawhide, and updates
testign for older Fedoras. Backports are planned for CentOS Stream 9+10 during
this RHEL y-stream release cycle.
When the dust settles, I plan to update
https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/ with the long
options.
Happy packaging,
--
Miro Hrončok
--
Phone: +420777974800