From 544c8457629e2d0e22cee5fd98d6611e0bf10474 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Sun, 19 Jan 2025 21:15:04 +0100 Subject: [PATCH] python3Packages.diofant: refactor --- .../python-modules/diofant/default.nix | 55 ++++++++++++++----- 1 file changed, 40 insertions(+), 15 deletions(-) diff --git a/pkgs/development/python-modules/diofant/default.nix b/pkgs/development/python-modules/diofant/default.nix index 03566cf27dc1..fc1bbff2f9de 100644 --- a/pkgs/development/python-modules/diofant/default.nix +++ b/pkgs/development/python-modules/diofant/default.nix @@ -2,27 +2,34 @@ lib, buildPythonPackage, cython, + fetchFromGitHub, fetchpatch, - fetchPypi, gmpy2, + hypothesis, mpmath, numpy, + pexpect, pythonOlder, + pytest-cov-stub, + pytest-timeout, + pytest-xdist, + pytestCheckHook, scipy, setuptools-scm, - wheel, }: buildPythonPackage rec { pname = "diofant"; version = "0.14.0"; - format = "pyproject"; + pyproject = true; + disabled = pythonOlder "3.10"; - src = fetchPypi { - inherit version; - pname = "Diofant"; - hash = "sha256-c886y37xR+4TxZw9+3tb7nkTGxWcS+Ag/ruUUdpf7S4="; + src = fetchFromGitHub { + owner = "diofant"; + repo = "diofant"; + tag = "v${version}"; + hash = "sha256-+VM5JBj4NRhNwyAVhnsACg5cVyyxJ3IcOKNL1osr67E="; }; patches = [ @@ -33,12 +40,9 @@ buildPythonPackage rec { }) ]; - nativeBuildInputs = [ - setuptools-scm - wheel - ]; + build-system = [ setuptools-scm ]; - propagatedBuildInputs = [ mpmath ]; + dependencies = [ mpmath ]; optional-dependencies = { exports = [ @@ -49,14 +53,35 @@ buildPythonPackage rec { gmpy = [ gmpy2 ]; }; - # tests take ~1h - doCheck = false; + doCheck = false; # some tests get stuck easily + + pytestFlagsArray = [ + "-W" + "ignore::DeprecationWarning" + "-m 'not slow'" + ]; + + nativeCheckInputs = [ + hypothesis + pexpect + pytest-cov-stub + pytest-xdist + pytestCheckHook + ]; + + disabledTests = [ + # AssertionError: assert '9.9012134805...5147838841057' == '2.7182818284...2178525166427' + "test_evalf_fast_series" + # AssertionError: assert Float('0.0051000000000000004', dps=15) == Float('0.010050166663333571', dps=15) + "test_evalf_sum" + ]; pythonImportsCheck = [ "diofant" ]; meta = with lib; { + changelog = "https://diofant.readthedocs.io/en/latest/release/notes-${version}.html"; description = "Python CAS library"; - homepage = "https://diofant.readthedocs.io/"; + homepage = "https://github.com/diofant/diofant"; license = licenses.bsd3; maintainers = with maintainers; [ suhr ]; };