## START: Set by rpmautospec
## (rpmautospec version 0.6.0)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 2;
    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

Name:           python-pingouin
Version:        0.5.4
Release:        %autorelease
Summary:        Statistical package in Python based on Pandas

License:        GPL-3.0-only
URL:            https://pingouin-stats.org/
# PyPI tar does not contain docs and tests
Source:         https://github.com/raphaelvallat/pingouin/archive/v%{version}/pingouin-%{version}.tar.gz

# Fix penalty for LogisticRegression (#403)
# https://github.com/raphaelvallat/pingouin/pull/403
# https://github.com/raphaelvallat/pingouin/commit/0fb0277be107dac4fbcb607c6259e3d509e90da0
Patch:          https://github.com/raphaelvallat/pingouin/commit/0fb0277be107dac4fbcb607c6259e3d509e90da0.patch

# https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval
ExcludeArch:    %{ix86}

BuildRequires:  python3-devel

# The odd combination of an arched package with only noarch binary packages
# makes it easier for us to detect with arch-dependent test failures, since the
# tests will always be run on every platform, and easier for us to skip failing
# tests if necessary, since we can be sure that %%ifarch macros work as
# expected.
#
# Since the package still contains no compiled machine code, we still have no
# debuginfo.
%global debug_package %{nil}

%global _description %{expand:
Pingouin is an open-source statistical package written in Python 3 and based
mostly on Pandas and NumPy. Some of its main features are listed below. For a
full list of available functions, please refer to the API documentation.

  1. ANOVAs: N-ways, repeated measures, mixed, ancova
  2. Pairwise post-hocs tests (parametric and non-parametric) and pairwise
     correlations
  3. Robust, partial, distance and repeated measures correlations
  4. Linear/logistic regression and mediation analysis
  5. Bayes Factors
  6. Multivariate tests
  7. Reliability and consistency
  8. Effect sizes and power analysis
  9. Parametric/bootstrapped confidence intervals around an effect size or a
     correlation coefficient
 10. Circular statistics
 11. Chi-squared tests
 12. Plotting: Bland-Altman plot, Q-Q plot, paired plot, robust correlation…

Pingouin is designed for users who want simple yet exhaustive statistical
functions.

For example, the ttest_ind function of SciPy returns only the T-value and the
p-value. By contrast, the ttest function of Pingouin returns the T-value, the
p-value, the degrees of freedom, the effect size (Cohen’s d), the 95%
confidence intervals of the difference in means, the statistical power and the
Bayes Factor (BF10) of the test.}

%description %_description

%package -n python3-pingouin
Summary:        %{summary}
BuildArch:      noarch

%description -n python3-pingouin %_description

%package doc
Summary:        Documentation and examples for %{name}
BuildArch:      noarch

%description doc
%{summary}.

%prep
%autosetup -n pingouin-%{version} -p1
# Version was upper-bounded in 2223ca5a89c28511dc54101ed0b9501425fcca47; this
# is possibly a “Temp fix for bug in plot_paired.” Anyway, we cannot respect
# the version bound.
sed -r -i 's/(numpy)<.*/\1/' requirements-test.txt

%generate_buildrequires
%pyproject_buildrequires %{?with_tests:requirements-test.txt}

%build
%pyproject_wheel

%install
%pyproject_install
%pyproject_save_files -l pingouin

%check
%if %{with tests}
# TestMultivariate.test_box_m fails without this. See:
# https://docs.fedoraproject.org/en-US/packaging-guidelines/BLAS_LAPACK/#_tests
#
# Two new test failures fails in Fedora Rawhide
# https://github.com/raphaelvallat/pingouin/issues/402
export FLEXIBLAS=netlib

# Two new test failures fails in Fedora Rawhide
# https://github.com/raphaelvallat/pingouin/issues/402
k="${k-}${k+ and }not (TestRegression and test_linear_regression)"

%pytest -k "${k-}" -v
%endif

%files -n python3-pingouin -f %{pyproject_files}
%doc CODE_OF_CONDUCT.md
%doc README.rst

%files doc
%license LICENSE
%doc notebooks

%changelog
## START: Generated by rpmautospec
* Fri Apr 26 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.5.4-2
- Fix penalty for LogisticRegression (fix RHBZ#2276932)

* Wed Jan 31 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.5.4-1
- Update to 0.5.4 (close RHBZ#2258253)

* Wed Jan 31 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.5.3-12
- Work around or skip two new failing tests (close RHBZ#2261590)

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

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

* Thu Jan 04 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.5.3-8
- Assert that a license file is present in the .dist-info directory

* Sat Jul 29 2023 Sandro <devel@penguinpee.nl> - 0.5.3-5
- Fix failing tests in Python3.12 (RHBZ#2220406)
- Apply patch from upstream (RHBZ#2226012)
- Run tests verbosely

* Thu Jul 20 2023 Python Maint <python-maint@redhat.com> - 0.5.3-4
- Rebuilt for Python 3.12

* Sat Feb 25 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 0.5.3-3
- Fix crash in test_power_chi2

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

* Fri Dec 30 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.5.3-1
- Update to 0.5.3 (close RHBZ#2156968)

* Fri Dec 30 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.5.2-11
- Remove unused patch files

* Fri Dec 30 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.5.2-10
- Update description from upstream

* Fri Dec 30 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.5.2-9
- Spec file whitespace formatting

* Fri Dec 30 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.5.2-8
- Convert License to SPDX

* Fri Dec 30 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.5.2-7
- Fix License; no MIT without HTML docs

* Mon Dec 19 2022 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.5.2-6
- Drop support for i686

* Tue Aug 30 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.5.2-5
- Remove test skip for retired 32-bit arm arch.

* Tue Aug 30 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.5.2-4
- Remove workaround for pandas<1.3.4

* Tue Aug 30 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.5.2-3
- Fix compatibility with scikit-learn 1.1.2 (fix RHBZ#2122144)

* Mon Aug 15 2022 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 0.5.2-2
- chore: rebuild for pyc magic number change (fixes rhbz#2113644)

* Mon Aug 01 2022 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 0.5.2-1
- feat: update to 0.5.2 (rhbz #2100936)

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

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

* Mon Feb 21 2022 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 0.5.1-1
- feat: update to 0.5.1 (fixes rhbz#2056272)

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

* Fri Oct 29 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 0.5.0-1
- Update to 0.5.0 (close RHBZ#2018342)

* Thu Sep 23 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 0.4.0-1
- Update to 0.4.0
- Switch to pyproject-rpm-macros to avoid manual BR’s
- Use an arched source package with only noarch binary packages to ensure tests
  are run on all arches; while this package really is noarch, it has a history
  of arch-dependent test failures

* Fri Jul 23 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 0.3.12-3
- Fix RHBZ#1981679

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

* Thu Jun 17 2021 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.3.12-1
- Update to new release

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

* Sat May 22 2021 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.3.11-1
- Update to latest release

* Sun Mar 28 2021 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.3.10-1
- Update to new release

* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Sun Sep 13 2020 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.3.8-1
- Update to new release
- Fix BR on scipy

* Fri Sep 04 2020 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.3.7-1
- Update to new release

* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Sat Jul 04 2020 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.3.6-1
- Update to new release

* Thu Jun 25 2020 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.3.5-2
- Explicitly BR setuptools

* Sun Jun 21 2020 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.3.5-1
- Update to 0.3.5

* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 0.3.3-2
- Rebuilt for Python 3.9

* Sat May 02 2020 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.3.3-1
- Update to latest release

* Fri Dec 06 2019 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.3.1-1
- Update to 0.3.1

* Sat Nov 09 2019 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.2.9-1
- Update to 0.2.9
- rebuild since scipy 1.3.0 is now available in rawhide
- Requires pandas-flavor, needs packaging

* Sat Jul 20 2019 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.2.7-1
- Correct license
- Add missing BR
- Add notebooks to documentation

* Fri Jul 19 2019 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.2.7-1
- Initial build

## END: Generated by rpmautospec