evcc: 0.131.4 -> 0.131.5
[NixPkgs.git] / pkgs / development / python-modules / deepwave / default.nix
blob56b9765686e84e2e9d7f1d8e8eaf96939128ded2
2   lib,
3   buildPythonPackage,
4   fetchFromGitHub,
5   torch,
6   ninja,
7   scipy,
8   which,
9   pybind11,
10   pytest-xdist,
11   pytestCheckHook,
14 let
15   linePatch = ''
16     import os
17     os.environ['PATH'] = os.environ['PATH'] + ':${ninja}/bin'
18   '';
20 buildPythonPackage rec {
21   pname = "deepwave";
22   version = "0.0.18";
23   format = "pyproject";
25   src = fetchFromGitHub {
26     owner = "ar4";
27     repo = pname;
28     rev = "v${version}";
29     hash = "sha256-DOOy+B12jgwJzQ90qzX50OFxYLPRcVdVYSE5gi3pqDM=";
30   };
32   # unable to find ninja although it is available, most likely because it looks for its pip version
33   postPatch = ''
34     substituteInPlace setup.cfg --replace "ninja" ""
36     # Adding ninja to the path forcibly
37     mv src/deepwave/__init__.py tmp
38     echo "${linePatch}" > src/deepwave/__init__.py
39     cat tmp >> src/deepwave/__init__.py
40     rm tmp
41   '';
43   # The source files are compiled at runtime and cached at the
44   # $HOME/.cache folder, so for the check phase it is needed to
45   # have a temporary home. This is also the reason ninja is not
46   # needed at the nativeBuildInputs, since it will only be used
47   # at runtime.
48   preBuild = ''
49     export HOME=$(mktemp -d)
50   '';
52   propagatedBuildInputs = [
53     torch
54     pybind11
55   ];
57   nativeCheckInputs = [
58     which
59     scipy
60     pytest-xdist
61     pytestCheckHook
62   ];
64   pythonImportsCheck = [ "deepwave" ];
66   meta = with lib; {
67     description = "Wave propagation modules for PyTorch";
68     homepage = "https://github.com/ar4/deepwave";
69     license = licenses.mit;
70     platforms = intersectLists platforms.x86_64 platforms.linux;
71     maintainers = with maintainers; [ atila ];
72   };