%global pypi_name pyafq Name: python-%{pypi_name} Version: 3.4 Release: 1%{?dist} Summary: Automated Fiber Quantification: tractometry of diffusion MRI License: BSD-2-Clause URL: https://github.com/tractometry/pyAFQ Source0: %{pypi_source %{pypi_name}} # The citation export uses bibtexparser 2's parse_file/write_file/Library; # Fedora ships bibtexparser 1.4. Same result through the 1.x load/dump API. Patch0: python-pyafq-bibtexparser1.patch BuildArch: noarch BuildRequires: python3-devel BuildRequires: pyproject-rpm-macros BuildRequires: python3dist(pytest) %global _description %{expand: pyAFQ runs the Automated Fiber Quantification pipeline on diffusion MRI: tensor, kurtosis, CSD and multi-shell models; whole-brain tractography; registration to a template; recognition and cleaning of the major white matter bundles from waypoint ROIs, probability maps and endpoints; and tract profiles of any scalar along each bundle, with interactive HTML visualisations. It runs on a single subject (ParticipantAFQ, or the pyAFQ command) or on a BIDS dataset (GroupAFQ). Templates, atlases and neural network models are downloaded on first use (TemplateFlow, figshare and others); "pyAFQ download" fetches them all in advance. Static PNG export of the plotly figures needs kaleido, which is not packaged; the HTML figures do not.} %description %_description %package -n python3-%{pypi_name} Summary: %{summary} %description -n python3-%{pypi_name} %_description %prep %autosetup -p1 -n %{pypi_name}-%{version} # Runtime requirements, adjusted for what Fedora and this COPR provide: # - python_requires "<3.14": no code reason found; Fedora 44 is Python 3.14 and # the import and test runs below are the check. # - ray, toml: never imported. # - kaleido ==1.4.0: only plotly's write_image (static PNG montages) uses it, # and kaleido 1.x drives a Chrome browser; not packaged. # - plotly ==7.1.0: this COPR has 6.9; pyAFQ uses only long-stable plotly API. # - imageio[ffmpeg,pyav]: the extras are for MP4 export (viz_backend "plotly"); # the default "plotly_no_mp4" and GIF output need imageio alone. # - bibtexparser >=2.0: see Patch0. sed -i \ -e 's/^python_requires = >=3.11, <3.14$/python_requires = >=3.11/' \ -e '/^\tray$/d' \ -e '/^\ttoml>=0.10.0$/d' \ -e '/^\tkaleido==1.4.0$/d' \ -e 's/^\tplotly==7.1.0$/\tplotly/' \ -e 's/^\timageio\[ffmpeg,pyav\]>=2.0.0$/\timageio>=2.0.0/' \ -e 's/^\tbibtexparser>=2.0$/\tbibtexparser/' \ setup.cfg ! grep -E '<3\.14|^\t(ray|toml|kaleido)|plotly==|imageio\[|bibtexparser>=2' setup.cfg %py3_shebang_fix bin %generate_buildrequires export SETUPTOOLS_SCM_PRETEND_VERSION=%{version} %pyproject_buildrequires %build export SETUPTOOLS_SCM_PRETEND_VERSION=%{version} %pyproject_wheel %install %pyproject_install %pyproject_save_files AFQ %check export HOME=$PWD/home MPLBACKEND=Agg NO_ET=1 mkdir -p $HOME # AFQ.viz.fury_backend needs fury 2 (this COPR has 0.12, the optional "fury" # viz backend); AFQ.nn needs onnxruntime (optional "nn" extra). # AFQ.utils.docs is a documentation helper that needs IPython. %pyproject_check_import -e '*.tests*' -e 'AFQ.utils.docs' -e 'AFQ.viz.fury_backend' -e 'AFQ.nn*' %{py3_test_envvars} %{buildroot}%{_bindir}/pyAFQ --help | grep -q 'pyAFQ download' cd %{_builddir} # Modules that download data at import or in every test (dipy's Stanford # HARDI, TemplateFlow, figshare, OpenNeuro) are ignored or deselected: all 7 # failures of the full run in a network-less build were name-resolution errors. %pytest -v -p no:cacheprovider --pyargs AFQ \ --ignore-glob='*/AFQ/tests/test_registration.py' \ --ignore-glob='*/AFQ/tests/test_api.py' \ --ignore-glob='*/AFQ/tests/test_data.py' \ --ignore-glob='*/AFQ/tests/test_nn.py' \ --ignore-glob='*/AFQ/recognition/tests/test_recognition.py' \ --ignore-glob='*/AFQ/recognition/tests/test_utils.py' \ --ignore-glob='*/AFQ/nn/tests/*' \ -k 'not (test_AFQ_custom_bundle_dict or test_BundleDict or test_gaussian_weights or test_matlab_tractography or test_matlab_mori_groups or test_density_map or test_transform_roi_real_mapping)' %files -n python3-%{pypi_name} -f %{pyproject_files} %license LICENSE %doc README.md CHANGES.rst CITATION %{_bindir}/pyAFQ %{_bindir}/pyAFQ-bids %changelog * Fri Oct 16 2026 Morgan Hough - 3.4-1 - Initial package.