Blame python-sklearn-genetic-opt.spec

c37c58c
%global forgeurl https://github.com/rodrigo-arenas/Sklearn-genetic-opt
c37c58c
%global tag %{version}
c37c58c
%forgemeta
c37c58c
c37c58c
%bcond_without tests
c37c58c
c37c58c
# Sphinx-generated HTML documentation is not suitable for packaging; see
c37c58c
# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
c37c58c
#
c37c58c
# We can generate PDF documentation as a substitute.
c37c58c
c37c58c
%bcond_without doc_pdf
c37c58c
c37c58c
%global pypi_name sklearn-genetic-opt
c37c58c
%global orig_name Sklearn-genetic-opt
c37c58c
c37c58c
%global _description %{expand:
c37c58c
scikit-learn models hyperparameters tuning and feature selection, using
c37c58c
evolutionary algorithms. This is meant to be an alternative to popular
c37c58c
methods inside scikit-learn such as Grid Search and Randomized Grid
c37c58c
Search for hyperparameteres tuning, and from RFE, Select From Model for
c37c58c
feature selection. Sklearn-genetic-opt uses evolutionary algorithms
c37c58c
from the DEAP package to choose the set of hyperparameters that
c37c58c
optimizes (max or min) the cross-validation scores, it can be used
c37c58c
for both regression and classification problems.}
c37c58c
c37c58c
Name:           python-%{pypi_name}
e45abff
Version:        0.10.1
c37c58c
Release:        %autorelease
c37c58c
Summary:        Hyperparameters tuning and feature selection
c37c58c
c37c58c
License:        MIT
c37c58c
URL:            https://github.com/rodrigo-arenas/Sklearn-genetic-opt
c37c58c
Source0:        %{forgesource}
c37c58c
c37c58c
BuildArch:      noarch
c37c58c
b76c548
# https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval
b76c548
ExcludeArch:    %{ix86}
b76c548
c37c58c
%description %_description
c37c58c
c37c58c
%package -n python3-%{pypi_name}
c37c58c
Summary:        %{summary}
c37c58c
c37c58c
BuildRequires:  make
c37c58c
BuildRequires:  python3-devel
c37c58c
BuildRequires:  %{py3_dist pandas}
c37c58c
BuildRequires:  %{py3_dist matplotlib}
c37c58c
c37c58c
%if %{with tests}
c37c58c
BuildRequires:  python3dist(pytest)
c37c58c
%endif
c37c58c
c37c58c
%description -n python3-%{pypi_name} %_description
c37c58c
c37c58c
%package doc
c37c58c
Summary:        %{summary}
c37c58c
c37c58c
%if %{with doc_pdf}
c37c58c
BuildRequires:  make
c37c58c
BuildRequires:  python3-sphinx-latex
c37c58c
BuildRequires:  latexmk
c37c58c
BuildRequires:  ImageMagick
c37c58c
BuildRequires:  pandoc
c37c58c
BuildRequires:  %{py3_dist sphinx}
c37c58c
BuildRequires:  %{py3_dist sphinx-rtd-theme}
c37c58c
BuildRequires:  %{py3_dist sphinxcontrib-bibtex}
c37c58c
BuildRequires:  %{py3_dist sphinx-copybutton}
c37c58c
BuildRequires:  %{py3_dist sphinx-gallery}
c37c58c
BuildRequires:  %{py3_dist numpydoc}
c37c58c
BuildRequires:  %{py3_dist nbsphinx}
c37c58c
%endif
c37c58c
c37c58c
%description doc
c37c58c
Documentation for %{name}.
c37c58c
c37c58c
%prep
c37c58c
%autosetup -p1 -n %{orig_name}-%{version}
c37c58c
c37c58c
%generate_buildrequires
c37c58c
# Cannot package “mlflow” or “all” extras due to missing mlflow dependency
c37c58c
%pyproject_buildrequires -x seaborn
c37c58c
c37c58c
%build
c37c58c
%pyproject_wheel
c37c58c
c37c58c
%if %{with doc_pdf}
c37c58c
%make_build -C docs latex SPHINXOPTS='%{?_smp_mflags}'
c37c58c
c37c58c
# convert gif to png and take the first frame
c37c58c
convert docs/_build/latex/progress_bar.gif docs/_build/latex/progress_bar.png
c37c58c
sed -i 's/{progress_bar}.gif/{progress_bar-0}.png/g' docs/_build/latex/sklearngeneticopt.tex
c37c58c
%make_build -C docs/_build/latex LATEXMKOPTS='-quiet'
c37c58c
%endif
c37c58c
c37c58c
%install
c37c58c
%pyproject_install
c37c58c
%pyproject_save_files sklearn_genetic
c37c58c
c37c58c
%check
c37c58c
%if %{with tests}
d5cd334
# test_tensorboard_callback fails due to missing tensorflow dep
d5cd334
# https://github.com/rodrigo-arenas/Sklearn-genetic-opt/issues/134
d5cd334
k="not test_tensorboard_callback"
d5cd334
# Two failing tests in Python3.12, Disable for now.
d5cd334
# TODO: investigate and report failing tests upstream
d5cd334
k="${k} and not test_wrong_scheduler_methods"
d5cd334
k="${k} and not test_wrong_dimension"
e45abff
# Exclude test_mlflow -- mlflow dependency is missing
d5cd334
%pytest --ignore sklearn_genetic/tests/test_mlflow.py -k "${k}" -v
c37c58c
%endif
c37c58c
c37c58c
%files -n python3-sklearn-genetic-opt -f %{pyproject_files}
c37c58c
%doc README.rst
c37c58c
c37c58c
%files doc
c37c58c
%if %{with doc_pdf}
c37c58c
%doc docs/_build/latex/sklearngeneticopt.pdf
c37c58c
%endif
c37c58c
c37c58c
c37c58c
%changelog
c37c58c
%autochangelog