## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 1;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%bcond tests 1
# Sphinx-generated HTML documentation is not suitable for packaging; see
# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
#
# We can generate PDF documentation as a substitute.
%bcond doc_pdf 1

%global _description %{expand:
NiaClass is a framework for solving classification tasks using nature-inspired
algorithms. The framework is written fully in Python. Its goal is to find the
best possible set of classification rules for the input data using the NiaPy
framework, which is a popular Python collection of nature-inspired algorithms.
The NiaClass classifier support numerical and categorical features.}

Name:           python-niaclass
Version:        0.2.1
Release:        %autorelease
Summary:        Python framework for building classifiers using nature-inspired algorithms

# SPDX
License:        MIT
URL:            https://github.com/firefly-cpp/NiaClass
Source:         %{url}/archive/%{version}/NiaClass-%{version}.tar.gz

BuildArch:      noarch

BuildRequires:  python3-devel

# See [tool.poetry.dev-dependencies] in pyproject.toml; it mixes documentation,
# testing, and other dev dependencies such as linters, formatters, and
# coverage-analysis tools, so we must track these dependencies manually.
%if %{with doc_pdf}
BuildRequires:  make
BuildRequires:  %{py3_dist sphinx}
BuildRequires:  python3-sphinx-latex
BuildRequires:  latexmk
# The HTML theme is imported in conf.py even for LaTeX builds.
BuildRequires:  %{py3_dist sphinx-rtd-theme}
%endif
%if %{with tests}
BuildRequires:  %{py3_dist pytest}
%endif

%description %_description

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

%description -n python3-niaclass %_description

%package doc
Summary:        Documentation and examples for python-niaclass

%description doc
%{summary}.

%prep
%autosetup -n NiaClass-%{version}
# The SemVer pins on dependencies are far too strict to be practical. Convert
# them to lower bounds.
sed -r -i 's/( = ")\^/\1>=/' pyproject.toml

%generate_buildrequires
%pyproject_buildrequires

%build
%pyproject_wheel

%if %{with doc_pdf}
PYTHONPATH="${PWD}" %make_build -C docs latex \
    SPHINXOPTS='-j%{?_smp_build_ncpus}'
%make_build -C docs/_build/latex LATEXMKOPTS='-quiet'
%endif

%install
%pyproject_install
%pyproject_save_files niaclass

%check
%pyproject_check_import
%if %{with tests}
%pytest
%endif

%files -n python3-niaclass -f %{pyproject_files}
%license LICENSE
%doc README.md
%doc CHANGELOG.md
%doc CITATION.cff

%files doc
%license LICENSE
%doc CITATION.cff

%doc examples/

%if %{with doc_pdf}
%doc docs/_build/latex/niaclass.pdf
%endif

%changelog
## START: Generated by rpmautospec
* Thu Nov 28 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2.1-1
- Update to 0.2.1 (close RHBZ#2329306)
- Updated upstream URL

* Thu Nov 28 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2.0-18
- Improved Summary/description for -doc subpackage

* Thu Nov 28 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2.0-17
- Always run an import-only “smoke test,” even when tests are disabled

* Thu Nov 28 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2.0-16
- Build docs as PDF instead of HTML due to guidelines issues

* Thu Nov 28 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2.0-14
- Confirm the License is SPDX MIT

* Thu Nov 28 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2.0-13
- Convert strict SemVer pins to lower-bounds
- This is a bit more conservative than the previous approach of removing
  the version bounds entirely.

* Thu Nov 28 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2.0-9
- Remove several spurious manual BuildRequires

* Thu Nov 28 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2.0-8
- Drop coverage-analysis build dependencies

* Fri Jul 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

* Sun Jun 09 2024 Python Maint <python-maint@redhat.com> - 0.2.0-2
- Rebuilt for Python 3.13

* Mon Mar 25 2024 Iztok Fister Jr. <iztokf AT fedoraproject DOT org> - 0.2.0-1
- Update to the latest upstream's release

* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.4-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.4-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Mon Oct 30 2023 Miro Hrončok <mhroncok@redhat.com> - 0.1.4-4
- Drop a needles BuildRequires on python3-pep517

* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Tue Jul 04 2023 Python Maint <python-maint@redhat.com> - 0.1.4-2
- Rebuilt for Python 3.12

* Tue Feb 7 2023 Iztok Fister Jr. <iztokf AT fedoraproject DOT org> - 0.1.4-1
- Update to the latest upstream's release

* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Wed Oct 26 2022 Iztok Fister Jr. <iztokf AT fedoraproject DOT org> - 0.1.3-1
- Update to the latest upstream's release

* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.2-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Mon Jul 04 2022 Python Maint <python-maint@redhat.com> - 0.1.2-7
- Rebuilt for Python 3.11

* Mon Jan 24 2022 Iztok Fister Jr. <iztokf AT fedoraproject DOT org> - 0.1.2-6
- Remove dependency (pyproject-rpm-macros)

* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Wed Jun 30 2021 Iztok Fister Jr. <iztokf AT fedoraproject DOT org> - 1.1.2-2
- Minor corrections

* Mon Jun 28 2021 Iztok Fister Jr. <iztokf AT fedoraproject DOT org> - 1.1.2-1
- Update to the latest upstream's major release

* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 0.1.1-2
- Rebuilt for Python 3.10

* Tue May 25 2021 Iztok Fister Jr. <iztokf AT fedoraproject DOT org> - 0.1.1-1
- Update to the latest upstream's release
- Remove patch

* Thu Apr 15 2021 Iztok Fister Jr. <iztokf AT fedoraproject DOT org> - 0.1.0-1
- Initial package

## END: Generated by rpmautospec