1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 gmpy2,
6 isPyPy,
7 setuptools,
8 pytestCheckHook,
9
10 # Reverse dependency
11 sage,
12}:
13
14buildPythonPackage rec {
15 pname = "mpmath";
16 version = "1.3.0";
17 format = "setuptools";
18
19 src = fetchFromGitHub {
20 owner = "mpmath";
21 repo = "mpmath";
22 tag = version;
23 hash = "sha256-9BGcaC3TyolGeO65/H42T/WQY6z5vc1h+MA+8MGFChU=";
24 };
25
26 nativeBuildInputs = [ setuptools ];
27
28 optional-dependencies = {
29 gmpy = lib.optionals (!isPyPy) [ gmpy2 ];
30 };
31
32 passthru.tests = {
33 inherit sage;
34 };
35
36 nativeCheckInputs = [ pytestCheckHook ];
37
38 meta = with lib; {
39 homepage = "https://mpmath.org/";
40 description = "Pure-Python library for multiprecision floating arithmetic";
41 license = licenses.bsd3;
42 maintainers = with maintainers; [ lovek323 ];
43 platforms = platforms.unix;
44 };
45}