about summary refs log tree commit diff
path: root/pkgs/development/python-modules/aesara/default.nix
blob: a7e5ee14366735a8a27896f7132bea742ab8877f (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
{
  lib,
  stdenv,
  buildPythonPackage,
  cons,
  cython,
  etuples,
  fetchFromGitHub,
  filelock,
  hatch-vcs,
  hatchling,
  jax,
  jaxlib,
  logical-unification,
  minikanren,
  numba,
  numba-scipy,
  numpy,
  pytestCheckHook,
  pythonAtLeast,
  pythonOlder,
  scipy,
  typing-extensions,
}:

buildPythonPackage rec {
  pname = "aesara";
  version = "2.9.3";
  pyproject = true;

  # Python 3.12 is not supported: https://github.com/aesara-devs/aesara/issues/1520
  disabled = pythonOlder "3.8" || pythonAtLeast "3.12";

  src = fetchFromGitHub {
    owner = "aesara-devs";
    repo = "aesara";
    rev = "refs/tags/rel-${version}";
    hash = "sha256-aO0+O7Ts9phsV4ghunNolxfAruGBbC+tHjVkmFedcCI=";
  };

  build-system = [
    cython
    hatch-vcs
    hatchling
  ];

  dependencies = [
    cons
    etuples
    filelock
    logical-unification
    minikanren
    numpy
    scipy
    typing-extensions
  ];

  nativeCheckInputs = [
    jax
    jaxlib
    numba
    numba-scipy
    pytestCheckHook
  ];

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail "--durations=50" "" \
      --replace-fail "hatch-vcs >=0.3.0,<0.4.0" "hatch-vcs"
  '';

  preBuild = ''
    export HOME=$(mktemp -d)
  '';

  pythonImportsCheck = [ "aesara" ];

  disabledTestPaths = [
    # Don't run the most compute-intense tests
    "tests/scan/"
    "tests/tensor/"
    "tests/sandbox/"
    "tests/sparse/sandbox/"
    # JAX is not available on all platform and often broken
    "tests/link/jax/"

    # 2024-04-27: The current nixpkgs numba version is too recent and incompatible with aesara 2.9.3
    "tests/link/numba/"
  ];

  disabledTests = [
    # Disable all benchmark tests
    "test_scan_multiple_output"
    "test_logsumexp_benchmark"

    # TypeError: exceptions must be derived from Warning, not <class 'NoneType'>
    "test_api_deprecation_warning"
    # AssertionError: assert ['Elemwise{Co..._i{0} 0', ...] == ['Elemwise{Co..._i{0} 0', ...]
    # At index 3 diff: '| |Gemv{inplace} d={0: [0]} 2' != '| |CGemv{inplace} d={0: [0]} 2'
    "test_debugprint"
    # ValueError: too many values to unpack (expected 3)
    "test_ExternalCOp_c_code_cache_version"
  ];

  meta = with lib; {
    description = "Python library to define, optimize, and efficiently evaluate mathematical expressions involving multi-dimensional arrays";
    homepage = "https://github.com/aesara-devs/aesara";
    changelog = "https://github.com/aesara-devs/aesara/releases/tag/rel-${version}";
    license = licenses.bsd3;
    maintainers = with maintainers; [ Etjean ];
    broken = (stdenv.isLinux && stdenv.isAarch64);
  };
}