1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, numpy
5, pytestCheckHook
6, pythonOlder
7, scipy
8}:
9
10buildPythonPackage rec {
11 pname = "numdifftools";
12 version = "0.9.41";
13 format = "setuptools";
14
15 disabled = pythonOlder "3.7";
16
17 src = fetchFromGitHub {
18 owner = "pbrod";
19 repo = pname;
20 rev = "v${version}";
21 hash = "sha256-HYacLaowSDdrwkxL1h3h+lw/8ahzaecpXEnwrCqMCWk=";
22 };
23
24 propagatedBuildInputs = [
25 numpy
26 scipy
27 ];
28
29 # Tests requires algopy and other modules which are optional and/or not available
30 doCheck = false;
31
32 postPatch = ''
33 substituteInPlace setup.py \
34 --replace '"pytest-runner"' ""
35 # Remove optional dependencies
36 substituteInPlace requirements.txt \
37 --replace "algopy>=0.4" "" \
38 --replace "statsmodels>=0.6" ""
39 '';
40
41 pythonImportsCheck = [
42 "numdifftools"
43 ];
44
45 meta = with lib; {
46 description = "Library to solve automatic numerical differentiation problems in one or more variables";
47 homepage = "https://github.com/pbrod/numdifftools";
48 license = licenses.bsd3;
49 maintainers = with maintainers; [ fab ];
50 };
51}