1{
2 lib,
3 pythonOlder,
4 buildPythonPackage,
5 fetchFromGitHub,
6 arrow,
7 nest-asyncio,
8 qiskit-terra,
9 requests,
10 requests-ntlm,
11 websocket-client,
12 # Visualization inputs
13 withVisualization ? true,
14 ipython,
15 ipyvuetify,
16 ipywidgets,
17 matplotlib,
18 plotly,
19 pyperclip,
20 seaborn,
21 # check inputs
22 pytestCheckHook,
23 nbconvert,
24 nbformat,
25 pproxy,
26 qiskit-aer,
27 websockets,
28 vcrpy,
29}:
30
31let
32 visualizationPackages = [
33 ipython
34 ipyvuetify
35 ipywidgets
36 matplotlib
37 plotly
38 pyperclip
39 seaborn
40 ];
41in
42buildPythonPackage rec {
43 pname = "qiskit-ibmq-provider";
44 version = "0.20.2";
45 format = "setuptools";
46
47 disabled = pythonOlder "3.6";
48
49 src = fetchFromGitHub {
50 owner = "Qiskit";
51 repo = pname;
52 rev = "refs/tags/${version}";
53 hash = "sha256-7dIspeJpukLDfICoBPPZZWdzkVumtvh+NRxvtmnvWH0=";
54 };
55
56 propagatedBuildInputs = [
57 arrow
58 nest-asyncio
59 qiskit-terra
60 requests
61 requests-ntlm
62 websocket-client
63 websockets
64 ]
65 ++ lib.optionals withVisualization visualizationPackages;
66
67 postPatch = ''
68 substituteInPlace setup.py --replace "websocket-client>=1.0.1" "websocket-client"
69 '';
70
71 # Most tests require credentials to run on IBMQ
72 nativeCheckInputs = [
73 pytestCheckHook
74 nbconvert
75 nbformat
76 pproxy
77 qiskit-aer
78 vcrpy
79 ]
80 ++ lib.optionals (!withVisualization) visualizationPackages;
81
82 pythonImportsCheck = [ "qiskit.providers.ibmq" ];
83 disabledTests = [
84 "test_coder_operators" # fails for some reason on nixos-21.05+
85 # These disabled tests require internet connection, aren't skipped elsewhere
86 "test_old_api_url"
87 "test_non_auth_url"
88 "test_non_auth_url_with_hub"
89 "test_coder_optimizers" # TODO: reenable when package scikit-quant is packaged, either in NUR or nixpkgs
90
91 # slow tests
92 "test_websocket_retry_failure"
93 "test_invalid_url"
94 ];
95
96 # Skip tests that rely on internet access (mostly to IBM Quantum Experience cloud).
97 # Options defined in qiskit.terra.test.testing_options.py::get_test_options
98 preCheck = ''
99 export QISKIT_TESTS=skip_online
100 '';
101
102 meta = with lib; {
103 description = "Qiskit provider for accessing the quantum devices and simulators at IBMQ";
104 homepage = "https://github.com/Qiskit/qiskit-ibmq-provider";
105 changelog = "https://qiskit.org/documentation/release_notes.html";
106 license = licenses.asl20;
107 maintainers = with maintainers; [ drewrisinger ];
108 };
109}