%global         pypi_name       pygmtools
%global         forgeurl        https://github.com/Thinklab-SJTU/pygmtools
Version:        0.4.0
%global         tag             %{version}
%forgemeta

Name:           python-%{pypi_name}
Release:        1%{?dist}
Summary:        A library of Python graph matching solvers

License:        MulanPSL-2.0
URL:            https://pygmtools.readthedocs.io/en/latest/
Source0:        %{forgesource}
# Run example without plotting as a smoke test
Patch:          noplot.patch
# https://github.com/Thinklab-SJTU/pygmtools/pull/79
Patch:          checkimport.patch

BuildRequires:  python3-devel
# Check
BuildRequires:  python3-cython
# Documentation
#BuildRequires:  python3-sphinx
#BuildRequires:  python3-sphinx-design
#BuildRequires:  python3-sphinx-gallery
# Need to package m2r2
#BuildRequires:  python3-m2r2
BuildArch: noarch

%global _description %{expand:
pygmtools (Python Graph Matching Tools) provides graph matching
solvers in Python.

Graph matching is a fundamental yet challenging problem in pattern
recognition, data mining, and others. Graph matching aims to find
node-to-node correspondence among multiple graphs, by solving an
NP-hard combinatorial optimization problem.

Doing graph matching in Python used to be difficult, and this library
wants to make researchers' lives easier.}

%description %_description

%package -n python3-%{pypi_name}
Summary:        %{summary}

%description -n python3-%{pypi_name} %_description


%prep
%forgeautosetup -p1

%generate_buildrequires
%pyproject_buildrequires


%build
%pyproject_wheel

# Build documentation
#sphinx-build -b man -D plot_gallery=0 -b man docs man1

%install
%pyproject_install
%pyproject_save_files %{pypi_name}

%check
# Only check import of main module, as other modules
# have dependencies that may not be available
%pyproject_check_import -t pygmtools

%files -n python3-%{pypi_name} -f %{pyproject_files}
%doc README.md
%doc docs/guide/*.rst

%changelog
* Mon Sep 11 2023 Benson Muite <benson_muite@emailplus.org> - 0.4.0-1
- Initial packaging