about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/torchsde/default.nix
blob: bffbeeaa2c9702800884dc30525d76ed986b49b7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{ lib
, buildPythonPackage
, fetchFromGitHub

# build-system
, setuptools

# dependencies
, boltons
, numpy
, scipy
, torch
, trampoline

# tests
, pytestCheckHook
}:

buildPythonPackage rec {
  pname = "torchsde";
  version = "0.2.6";
  format = "pyproject";

  src = fetchFromGitHub {
    owner = "google-research";
    repo = "torchsde";
    rev = "refs/tags/v${version}";
    hash = "sha256-D0p2tL/VvkouXrXfRhMuCq8wMtzeoBTppWEG5vM1qCo=";
  };

  postPatch = ''
    substituteInPlace setup.py \
      --replace "numpy==1.19.*" "numpy" \
      --replace "scipy==1.5.*" "scipy"
  '';

  nativeBuildInputs = [
    setuptools
  ];

  propagatedBuildInputs = [
    boltons
    numpy
    scipy
    torch
    trampoline
  ];

  pythonImportsCheck = [ "torchsde" ];

  nativeCheckInputs = [
    pytestCheckHook
  ];

  pytestFlagsArray = [
    "-W" "ignore::pytest.PytestRemovedIn8Warning"
  ];

  disabledTests = [
    # RuntimeError: a view of a leaf Variable that requires grad is being used in an in-place operation.
    "test_adjoint"
  ];

  meta = with lib; {
    changelog = "https://github.com/google-research/torchsde/releases/tag/v${version}";
    description = "Differentiable SDE solvers with GPU support and efficient sensitivity analysis";
    homepage = "https://github.com/google-research/torchsde";
    license = licenses.asl20;
    maintainers = teams.tts.members;
  };
}