From 05e470828d4afc60431aca0d1f25192681ed2abf Mon Sep 17 00:00:00 2001 From: Maksym Balatsko Date: Wed, 20 Sep 2023 23:48:28 -0700 Subject: [PATCH] python3Packages.scikit-posthocs: init at 0.7.0 --- ...ased-abs-tolerance-for-wilcoxon-test.patch | 25 +++++++ .../0002-Update-test_posthocs.py.patch | 34 ++++++++++ .../scikit-posthocs/default.nix | 65 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 4 files changed, 126 insertions(+) create mode 100644 pkgs/development/python-modules/scikit-posthocs/0001-increased-abs-tolerance-for-wilcoxon-test.patch create mode 100644 pkgs/development/python-modules/scikit-posthocs/0002-Update-test_posthocs.py.patch create mode 100644 pkgs/development/python-modules/scikit-posthocs/default.nix diff --git a/pkgs/development/python-modules/scikit-posthocs/0001-increased-abs-tolerance-for-wilcoxon-test.patch b/pkgs/development/python-modules/scikit-posthocs/0001-increased-abs-tolerance-for-wilcoxon-test.patch new file mode 100644 index 00000000000..e3fa524e5a4 --- /dev/null +++ b/pkgs/development/python-modules/scikit-posthocs/0001-increased-abs-tolerance-for-wilcoxon-test.patch @@ -0,0 +1,25 @@ +From 02266a00ce0eb6a089e7efe07816da1aa5152fc9 Mon Sep 17 00:00:00 2001 +From: Maksim Terpilovskii +Date: Sun, 31 Jul 2022 12:25:14 +0300 +Subject: [PATCH] increased abs tolerance for wilcoxon test + +--- + tests/test_posthocs.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/test_posthocs.py b/tests/test_posthocs.py +index 956d808..8cc65e4 100644 +--- a/tests/test_posthocs.py ++++ b/tests/test_posthocs.py +@@ -471,7 +471,7 @@ class TestPosthocs(unittest.TestCase): + [2.857818e-06, 1.230888e-05, 1]]) + + results = sp.posthoc_wilcoxon(self.df.sort_index(), val_col = 'pulse', group_col = 'kind') +- self.assertTrue(np.allclose(results, r_results)) ++ self.assertTrue(np.allclose(results, r_results, atol=1e-4)) + + + def test_posthoc_scheffe(self): +-- +2.36.1 + diff --git a/pkgs/development/python-modules/scikit-posthocs/0002-Update-test_posthocs.py.patch b/pkgs/development/python-modules/scikit-posthocs/0002-Update-test_posthocs.py.patch new file mode 100644 index 00000000000..fa4d6d3ecec --- /dev/null +++ b/pkgs/development/python-modules/scikit-posthocs/0002-Update-test_posthocs.py.patch @@ -0,0 +1,34 @@ +From 5416ffba3ab01aebab3909400b5a9e847022898e Mon Sep 17 00:00:00 2001 +From: Maksim Terpilovskii +Date: Thu, 16 Mar 2023 00:20:02 +0300 +Subject: [PATCH] Update test_posthocs.py + +--- + tests/test_posthocs.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/test_posthocs.py b/tests/test_posthocs.py +index 8cc65e4..42ca5f3 100644 +--- a/tests/test_posthocs.py ++++ b/tests/test_posthocs.py +@@ -71,7 +71,7 @@ class TestPosthocs(unittest.TestCase): + a = splt.sign_plot(x, flat=True, labels=False) + with self.assertRaises(ValueError): + splt.sign_plot(x.astype(float), flat=True, labels=False) +- self.assertTrue(isinstance(a, ma._subplots.Axes)) ++ self.assertTrue(isinstance(a, ma._axes.Axes)) + + def test_sign_plot_nonflat(self): + +@@ -85,7 +85,7 @@ class TestPosthocs(unittest.TestCase): + with self.assertRaises(ValueError): + splt.sign_plot(x.astype(np.int64), labels=False) + +- self.assertTrue(isinstance(a, ma._subplots.Axes) and isinstance(cbar, mpl.colorbar.ColorbarBase)) ++ self.assertTrue(isinstance(a, ma._axes.Axes) and isinstance(cbar, mpl.colorbar.ColorbarBase)) + + # Outliers tests + def test_outliers_iqr(self): +-- +2.36.1 + diff --git a/pkgs/development/python-modules/scikit-posthocs/default.nix b/pkgs/development/python-modules/scikit-posthocs/default.nix new file mode 100644 index 00000000000..d7df6518903 --- /dev/null +++ b/pkgs/development/python-modules/scikit-posthocs/default.nix @@ -0,0 +1,65 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, setuptools +, wheel +, matplotlib +, numpy +, pandas +, scipy +, seaborn +, statsmodels +, pytestCheckHook +, seaborn-data +}: + +buildPythonPackage rec { + pname = "scikit-posthocs"; + version = "0.7.0"; + format = "pyproject"; + + src = fetchFromGitHub { + owner = "maximtrp"; + repo = "scikit-posthocs"; + rev = "v${version}"; + hash = "sha256-IkvAc684AWEK427OGAa4qVy6leWmd3b8Dnhd5bYAt5I="; + }; + + patches = [ + # Fixed on master: https://github.com/maximtrp/scikit-posthocs/commit/02266a00ce0eb6a089e7efe07816da1aa5152fc9 + ./0001-increased-abs-tolerance-for-wilcoxon-test.patch + # Fixed on master: https://github.com/maximtrp/scikit-posthocs/commit/5416ffba3ab01aebab3909400b5a9e847022898e + ./0002-Update-test_posthocs.py.patch + ]; + + nativeBuildInputs = [ + setuptools + wheel + ]; + + propagatedBuildInputs = [ + matplotlib + numpy + pandas + scipy + seaborn + statsmodels + ]; + + preCheck = '' + # tests require to write to home directory + export SEABORN_DATA=${seaborn-data.exercise} + ''; + nativeCheckInputs = [ + pytestCheckHook + ]; + pythonImportsCheck = [ "scikit_posthocs" ]; + + meta = with lib; { + description = "Multiple Pairwise Comparisons (Post Hoc) Tests in Python"; + homepage = "https://github.com/maximtrp/scikit-posthocs"; + changelog = "https://github.com/maximtrp/scikit-posthocs/releases/tag/v${version}"; + license = licenses.mit; + maintainers = with maintainers; [ mbalatsko ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 94dee18cd0d..ff7569c7ca0 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -11649,6 +11649,8 @@ self: super: with self; { scikit-optimize = callPackage ../development/python-modules/scikit-optimize { }; + scikit-posthocs = callPackage ../development/python-modules/scikit-posthocs { }; + scikit-rf = callPackage ../development/python-modules/scikit-rf { }; scikits-odes = callPackage ../development/python-modules/scikits-odes { };