1{ lib
2, pythonOlder
3, buildPythonPackage
4, fetchFromGitHub
5 # C Inputs
6, blas
7, catch2
8, cmake
9, cython
10, fmt
11, muparserx
12, ninja
13, nlohmann_json
14, spdlog
15 # Python Inputs
16, cvxpy
17, numpy
18, pybind11
19, scikit-build
20 # Check Inputs
21, pytestCheckHook
22, ddt
23, fixtures
24, pytest-timeout
25, qiskit-terra
26}:
27
28buildPythonPackage rec {
29 pname = "qiskit-aer";
30 version = "0.8.0";
31 format = "pyproject";
32
33 disabled = pythonOlder "3.6";
34
35 src = fetchFromGitHub {
36 owner = "Qiskit";
37 repo = "qiskit-aer";
38 rev = version;
39 hash = "sha256-CWF3ehLs0HBXnYH11r+2CQwIcxddAfQm3ulAf1agl/o=";
40 };
41
42 nativeBuildInputs = [
43 cmake
44 ninja
45 scikit-build
46 ];
47
48 buildInputs = [
49 blas
50 catch2
51 fmt
52 muparserx
53 nlohmann_json
54 spdlog
55 ];
56
57 propagatedBuildInputs = [
58 cvxpy
59 cython # generates some cython files at runtime that need to be cython-ized
60 numpy
61 pybind11
62 ];
63
64 # tries to install pypi cmake package, not needed
65 postPatch = ''
66 substituteInPlace setup.py --replace "'cmake!=3.17,!=3.17.0'," ""
67 '';
68
69 # Disable using conan for build
70 preBuild = ''
71 export DISABLE_CONAN=1
72 '';
73
74 dontUseCmakeConfigure = true;
75
76 # *** Testing ***
77
78 pythonImportsCheck = [
79 "qiskit.providers.aer"
80 "qiskit.providers.aer.backends.qasm_simulator"
81 "qiskit.providers.aer.backends.controller_wrappers" # Checks C++ files built correctly. Only exists if built & moved to output
82 ];
83 # Slow tests
84 disabledTests = [
85 "test_paulis_1_and_2_qubits"
86 "test_3d_oscillator"
87 "_057"
88 "_136"
89 "_137"
90 "_139"
91 "_138"
92 "_140"
93 "_141"
94 "_143"
95 "_144"
96 "test_sparse_output_probabilities"
97 "test_reset_2_qubit"
98 ];
99 checkInputs = [
100 pytestCheckHook
101 ddt
102 fixtures
103 pytest-timeout
104 qiskit-terra
105 ];
106 pytestFlagsArray = [
107 "--timeout=30"
108 "--durations=10"
109 ];
110
111 preCheck = ''
112 # Tests include a compiled "circuit" which is auto-built in $HOME
113 export HOME=$(mktemp -d)
114 # move tests b/c by default try to find (missing) cython-ized code in /build/source dir
115 cp -r $TMP/$sourceRoot/test $HOME
116
117 # Add qiskit-aer compiled files to cython include search
118 pushd $HOME
119 '';
120 postCheck = "popd";
121
122 meta = with lib; {
123 description = "High performance simulators for Qiskit";
124 homepage = "https://qiskit.org/aer";
125 downloadPage = "https://github.com/QISKit/qiskit-aer/releases";
126 changelog = "https://qiskit.org/documentation/release_notes.html";
127 license = licenses.asl20;
128 maintainers = with maintainers; [ drewrisinger ];
129 };
130}