1{ lib
2, pythonOlder
3, buildPythonPackage
4, fetchFromGitHub
5, python
6, numpy
7, qiskit-terra
8, scikit-learn
9, scipy
10 # Optional package inputs
11, withVisualization ? false
12, matplotlib
13, withCvx ? false
14, cvxpy
15, withJit ? false
16, numba
17 # Check Inputs
18, pytestCheckHook
19, ddt
20, pyfakefs
21, qiskit-aer
22}:
23
24buildPythonPackage rec {
25 pname = "qiskit-ignis";
26 version = "0.6.0";
27
28 disabled = pythonOlder "3.6";
29
30 # Pypi's tarball doesn't contain tests
31 src = fetchFromGitHub {
32 owner = "Qiskit";
33 repo = "qiskit-ignis";
34 rev = version;
35 hash = "sha256-L5fwCMsN03ojiDvKIyqsGfUnwej1P7bpyHlL6mu7nh0=";
36 };
37
38 # hacky, fix https://github.com/Qiskit/qiskit-ignis/issues/532.
39 # TODO: remove on qiskit-ignis v0.5.2
40 postPatch = ''
41 substituteInPlace qiskit/ignis/mitigation/expval/base_meas_mitigator.py --replace "plt.axes" "'plt.axes'"
42 '';
43
44 propagatedBuildInputs = [
45 numpy
46 qiskit-terra
47 scikit-learn
48 scipy
49 ] ++ lib.optionals (withCvx) [ cvxpy ]
50 ++ lib.optionals (withVisualization) [ matplotlib ]
51 ++ lib.optionals (withJit) [ numba ];
52 postInstall = "rm -rf $out/${python.sitePackages}/docs"; # this dir can create conflicts
53
54 # Tests
55 pythonImportsCheck = [ "qiskit.ignis" ];
56 dontUseSetuptoolsCheck = true;
57 preCheck = "export HOME=$TMPDIR";
58 checkInputs = [
59 pytestCheckHook
60 ddt
61 pyfakefs
62 qiskit-aer
63 ];
64 disabledTests = [
65 "test_tensored_meas_cal_on_circuit" # Flaky test, occasionally returns result outside bounds
66 "test_qv_fitter" # execution hangs, ran for several minutes
67 ];
68
69 meta = with lib; {
70 description = "Qiskit tools for quantum hardware verification, noise characterization, and error correction";
71 homepage = "https://qiskit.org/ignis";
72 downloadPage = "https://github.com/QISKit/qiskit-ignis/releases";
73 changelog = "https://qiskit.org/documentation/release_notes.html";
74 license = licenses.asl20;
75 maintainers = with maintainers; [ drewrisinger ];
76 };
77}