From 216f731386c23ae6a32ea960257f47b62ba32917 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Thu, 19 Jun 2025 14:54:28 +0200 Subject: [PATCH] python3Packages.plotnine: relax mizani dependency and adapt to breaking changes --- .../python-modules/plotnine/default.nix | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/pkgs/development/python-modules/plotnine/default.nix b/pkgs/development/python-modules/plotnine/default.nix index 819f7f87a54c..5bc54a27ef58 100644 --- a/pkgs/development/python-modules/plotnine/default.nix +++ b/pkgs/development/python-modules/plotnine/default.nix @@ -19,6 +19,7 @@ pytestCheckHook, pytest-cov-stub, scikit-misc, + writableTmpDirAsHomeHook, }: buildPythonPackage rec { @@ -33,8 +34,26 @@ buildPythonPackage rec { hash = "sha256-nTMu0zx13XepqQyrJrAvBCjjHdY02tlXlFk2kITHZfI="; }; + # Fixes: TypeError: hue_pal.__init__() got an unexpected keyword argument 'color_space' + # + # In the mizani 0.14.0 release, hue_pal was changed to use HCL color space from HSL (or HSLuv) space. + # The previous functionality is still available with hls_pal. + postPatch = '' + substituteInPlace plotnine/scales/scale_color.py \ + --replace-fail \ + "from mizani.palettes import hue_pal" \ + "from mizani.palettes import hls_pal" \ + --replace-fail \ + "hue_pal(" \ + "hls_pal(" + ''; + build-system = [ setuptools-scm ]; + pythonRelaxDeps = [ + "mizani" + ]; + dependencies = [ matplotlib mizani @@ -49,12 +68,9 @@ buildPythonPackage rec { pytestCheckHook pytest-cov-stub scikit-misc + writableTmpDirAsHomeHook ]; - preCheck = '' - export HOME=$(mktemp -d) - ''; - pythonImportsCheck = [ "plotnine" ]; disabledTests = [