diff --git a/pkgs/development/python-modules/mpl-scatter-density/default.nix b/pkgs/development/python-modules/mpl-scatter-density/default.nix index 269425357b5f..f8b4444ec0d8 100644 --- a/pkgs/development/python-modules/mpl-scatter-density/default.nix +++ b/pkgs/development/python-modules/mpl-scatter-density/default.nix @@ -1,10 +1,9 @@ { lib, + stdenv, buildPythonPackage, pytestCheckHook, fetchFromGitHub, - fetchpatch, - pythonOlder, setuptools-scm, setuptools, fast-histogram, @@ -12,38 +11,28 @@ numpy, wheel, pytest-mpl, + writableTmpDirAsHomeHook, }: buildPythonPackage rec { pname = "mpl-scatter-density"; version = "0.8"; - format = "setuptools"; - - disabled = pythonOlder "3.6"; + pyproject = true; src = fetchFromGitHub { owner = "astrofrog"; repo = pname; tag = "v${version}"; - sha256 = "sha256-pDiKJAN/4WFf5icNU/ZGOvw0jqN3eGZHgilm2oolpbE="; + hash = "sha256-pDiKJAN/4WFf5icNU/ZGOvw0jqN3eGZHgilm2oolpbE="; }; - patches = [ - # https://github.com/astrofrog/mpl-scatter-density/pull/37 - (fetchpatch { - name = "distutils-removal.patch"; - url = "https://github.com/ifurther/mpl-scatter-density/commit/6feedabe1e82da67d8eec46a80eb370d9f334251.patch"; - sha256 = "sha256-JqWlSm8mIwqjRPa+kMEaKipJyzGEO+gJK+Q045N1MXA="; - }) - ]; - - nativeBuildInputs = [ + build-system = [ setuptools setuptools-scm wheel ]; - propagatedBuildInputs = [ + dependencies = [ matplotlib numpy fast-histogram @@ -52,8 +41,13 @@ buildPythonPackage rec { nativeCheckInputs = [ pytestCheckHook pytest-mpl + writableTmpDirAsHomeHook ]; + # Need to set MPLBACKEND=agg for headless `matplotlib` on darwin. + # https://github.com/matplotlib/matplotlib/issues/26292 + env.MPLBACKEND = lib.optionalString stdenv.hostPlatform.isDarwin "agg"; + disabledTests = [ # AssertionError: (240, 240) != (216, 216) # Erroneous pinning of figure DPI, sensitive to runtime environment