FS#75531 - [python-rapidfuzz] [Orphan] built using vendored libraries and uses wrong optimization level

Attached to Project: Community Packages
Opened by Pekka Ristola (pekkarr) - Sunday, 07 August 2022, 11:53 GMT
Last edited by Antonio Rojas (arojas) - Thursday, 27 April 2023, 16:23 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:
The python-rapidfuzz package uses three header-only C++ libraries, namely rapidfuzz-cpp, jarowinkler-cpp and Taskflow. These are vendored in the source distribution obtained from PyPI, but the build will search for system-wide installed libraries and those take priority if they are found. rapidfuzz-cpp (in community), jarowinkler-cpp and cpp-taskflow (in AUR) are the packages that provide these libraries. Currently those packages are not in makedepends so the vendored versions are used. The vendored Taskflow is also an old version (2.7.0) while the latest Taskflow version is 3.4.0.

The build output shows whether the vendored version or system version is used. When the build uses vendored library X, the build prints `Using packaged version of X` and when a system library is used, it prints `Using system supplied version of X`.

Another problem is that the build uses -O3 gcc optimization level because it uses the `Release` cmake build type. As explained in the CMake package guidelines[0] this can be fixed by setting the build type to `None`. The correct option to pass to `python -m build` is `-C--global-option=--build-type=None`, where `-C` is the `--config-setting` option to python-build, `--global-option` is an undocumented feature of python-setuptools `build_meta.py` which passes the following option to the underlying setup.py call, and `--build-type=None` is a python-scikit-build option[1]. For future reference, `--global-option` will be deprecated and renamed to `--build-option` in a future python-setuptools release, see [2]. In order to see the optimization level and other compiler flags, option `-C--global-option=-DCMAKE_VERBOSE_MAKEFILE=ON` for `python -m build` can be used.

Package python-jarowinkler has very similar issues, so I will list them here. It uses jarowinkler-cpp header-only library which is vendored in the source distribution. Adding jarowinkler-cpp (currently in AUR) to makedepends fixes this, as the system-wide installed library will take priority over the vendored one. python-jarowinkler also has the same issue with -O3 optimization as python-rapidfuzz, and the fix is exactly the same.

Another issue with both packages is that they use pre-generated cython sources instead of generating those during package build. However, doing this would require cython version 3.0 which is still in alpha stage.

Additional info:
* package version(s)
- python-rapidfuzz 2.4.2-2
- python-jarowinkler 1.2.0-2
* config and/or log files etc.
* links
[0] https://wiki.archlinux.org/title/CMake_package_guidelines#CMake_can_automatically_override_the_default_compiler_optimization_flag
[1] https://scikit-build.readthedocs.io/en/latest/usage.html#usage-scikit-build-options
[2] https://github.com/pypa/setuptools/pull/3380
This task depends upon

Closed by  Antonio Rojas (arojas)
Thursday, 27 April 2023, 16:23 GMT
Reason for closing:  Fixed
Additional comments about closing:  python-rapidfuzz 3.0.0
Comment by Toolybird (Toolybird) - Sunday, 07 August 2022, 21:03 GMT
Orphan pkg. Was only recently brought in as dep for python-levenshtein (also orphan). @arojas could you kindly take a look? If not, would someone else like to maintain?

Loading...