Merge pull request #119126 from fabaff/pycomfoconnect
[NixPkgs.git] / pkgs / development / python-modules / qiskit-ignis / default.nix
blob403fa0f05a9c0538a789c66a731d6ecab79ea652
1 { lib
2 , pythonOlder
3 , buildPythonPackage
4 , fetchFromGitHub
5 , python
6 , numpy
7 , qiskit-terra
8 , scikitlearn
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
24 buildPythonPackage rec {
25   pname = "qiskit-ignis";
26   version = "0.6.0";
28   disabled = pythonOlder "3.6";
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   };
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   '';
44   propagatedBuildInputs = [
45     numpy
46     qiskit-terra
47     scikitlearn
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
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   ];
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   };