1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6 importlib-metadata,
7 numpy,
8 pybind11,
9 pytestCheckHook,
10 pythonOlder,
11 setuptools,
12}:
13
14buildPythonPackage rec {
15 pname = "pyfma";
16 version = "0.1.6";
17 pyproject = true;
18
19 disabled = pythonOlder "3.7";
20
21 src = fetchFromGitHub {
22 owner = "nschloe";
23 repo = "pyfma";
24 rev = version;
25 hash = "sha256-1qNa+FcIAP1IMzdNKrEbTVPo6gTOSCvhTRIHm6REJoo=";
26 };
27
28 patches = [
29 # Replace deprecated np.find_common_type calls with np.promote_types, https://github.com/nschloe/pyfma/pull/17
30 (fetchpatch {
31 url = "https://github.com/nschloe/pyfma/commit/e12d69d97a97657ab4fec3e8f2b2859f4360bc03.patch";
32 hash = "sha256-BsQe4hpo+Cripa0FRGFnRBs1oQ1GZA1+ZYzycy5M4Ek=";
33 })
34 ];
35
36 build-system = [ setuptools ];
37
38 buildInputs = [ pybind11 ];
39
40 dependencies = [ numpy ] ++ lib.optionals (pythonOlder "3.8") [ importlib-metadata ];
41
42 nativeCheckInputs = [ pytestCheckHook ];
43
44 pythonImportsCheck = [ "pyfma" ];
45
46 meta = with lib; {
47 description = "Fused multiply-add for Python";
48 homepage = "https://github.com/nschloe/pyfma";
49 changelog = "https://github.com/nschloe/pyfma/releases/tag/${version}";
50 license = licenses.mit;
51 maintainers = [ ];
52 };
53}