# pytools -- Andreas Kloeckner's utility library, the dependency under # pyopencl, loopy and pycuda. # # CLASS 2 (compatible update) under docs/PACKAGING-POLICY.md: Fedora ships # python-pytools 2024.1.3 on f44, f45 and rawhide, and stock python3-pyopencl # 2025.2.6 declares pytools>=2025.1.6 but is not built with that floor, so on # every current Fedora `import pyopencl` fails with # ImportError: cannot import name 'Hash' from 'pytools' # Bugzilla 2432626 (filed 2026-01-25, NEW). babelbrain enumerates OpenCL # devices through pyopencl and exits at its first dialog when it finds none, # so with Fedora's pytools it cannot run on a machine without CUDA. This # package is carried here until Fedora's catches up; the right fix is a # dist-git update of python-pytools, which Morgan files. Drop this spec when # Fedora ships pytools >= 2025.1.6. # # Spec follows Fedora's (hatchling now, not setup.py). Same name, so it # installs over Fedora's: the API is a superset (persistent_dict gained # siphash-based hashing; nothing was removed that pyopencl, loopy or pycuda # in Fedora use), checked by importing pyopencl in %%check. %global pypi_name pytools Name: python-%{pypi_name} Version: 2026.1.1 Release: 1%{?dist} Summary: Collection of tools for Python License: MIT URL: https://github.com/inducer/pytools Source0: %{pypi_source %{pypi_name}} BuildArch: noarch BuildRequires: python3-devel # pytools.convergence and pytools.spatial_btree import numpy (upstream's # optional `numpy` extra); every consumer here has it, and %%check imports them. BuildRequires: python3-numpy %global _description %{expand: Pytools is a big bag of things that are "missing" from the Python standard library: small tool functions (len_iterable, argmin, tuple and permutation generation, ASCII table pretty printing, flatten, ...), a decorator module, a time-series logging module, batch job submission, a lexer, a persistent dictionary, and tagging and code-generation helpers used by pyopencl, loopy and pycuda.} %description %_description %package -n python3-%{pypi_name} Summary: %{summary} Recommends: python3-numpy %description -n python3-%{pypi_name} %_description %prep %autosetup -p1 -n %{pypi_name}-%{version} %generate_buildrequires %pyproject_buildrequires %build %pyproject_wheel %install %pyproject_install %pyproject_save_files -l %{pypi_name} %check # mpiwrap imports mpi4py, which is not a dependency; upstream ships its pytest # suite inside the package (pytools/test), which imports pytest. %pyproject_check_import -e pytools.mpiwrap -e pytools.mpi -e 'pytools.test*' # The names pyopencl 2025.2+ imports from pytools (the import that fails with # Fedora's 2024.1.3). python-pyopencl's own %%check imports pyopencl. cd / PYTHONPATH=%{buildroot}%{python3_sitelib} %{python3} -c 'from pytools import Hash, memoize, memoize_method' %files -n python3-%{pypi_name} -f %{pyproject_files} %doc README.rst %changelog * Sun Oct 11 2026 Morgan Hough - 2026.1.1-1 - Carry pytools 2026.1.1 so that stock Fedora python3-pyopencl 2025.2.6 can be imported (it needs pytools >= 2025.1.6; Fedora ships 2024.1.3 on f44, f45 and rawhide: Bugzilla 2432626). Without it babelbrain finds no OpenCL device and exits at its first dialog. Class-2 compatible update per docs/PACKAGING-POLICY.md; to be dropped when Fedora updates.