1{ lib
2, buildPythonPackage
3, fetchPypi
4, cython
5, jinja2
6, numpy
7, pyparsing
8, setuptools
9, sympy
10, pytest
11, pytest-xdist
12, python
13}:
14
15buildPythonPackage rec {
16 pname = "brian2";
17 version = "2.5.1";
18
19 src = fetchPypi {
20 pname = "Brian2";
21 inherit version;
22 hash = "sha256-x1EcS7PFCsjPYsq3Lt87SJRW4J5DE/OfdFs3NuyHiLw=";
23 };
24
25 patches = [
26 # Fix deprecated numpy types
27 # https://sources.debian.org/data/main/b/brian/2.5.1-3/debian/patches/numpy1.24.patch
28 ./numpy1.24.patch
29 ];
30
31 propagatedBuildInputs = [
32 cython
33 jinja2
34 numpy
35 pyparsing
36 setuptools
37 sympy
38 ];
39
40 checkInputs = [
41 pytest
42 pytest-xdist
43 ];
44
45 checkPhase = ''
46 runHook preCheck
47 # Cython cache lies in home directory
48 export HOME=$(mktemp -d)
49 cd $HOME && ${python.interpreter} -c "import brian2;assert brian2.test()"
50 runHook postCheck
51 '';
52
53 meta = with lib; {
54 description = "A clock-driven simulator for spiking neural networks";
55 homepage = "https://briansimulator.org/";
56 license = licenses.cecill21;
57 maintainers = with maintainers; [ jiegec ];
58 };
59}