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 ] ++ lib.optionals withVisualization visualizationPackages;
65
66 postPatch = ''
67 substituteInPlace setup.py --replace "websocket-client>=1.0.1" "websocket-client"
68 '';
69
70 # Most tests require credentials to run on IBMQ
71 nativeCheckInputs = [
72 pytestCheckHook
73 nbconvert
74 nbformat
75 pproxy
76 qiskit-aer
77 vcrpy
78 ] ++ lib.optionals (!withVisualization) visualizationPackages;
79
80 pythonImportsCheck = [ "qiskit.providers.ibmq" ];
81 disabledTests = [
82 "test_coder_operators" # fails for some reason on nixos-21.05+
83 # These disabled tests require internet connection, aren't skipped elsewhere
84 "test_old_api_url"
85 "test_non_auth_url"
86 "test_non_auth_url_with_hub"
87 "test_coder_optimizers" # TODO: reenable when package scikit-quant is packaged, either in NUR or nixpkgs
88
89 # slow tests
90 "test_websocket_retry_failure"
91 "test_invalid_url"
92 ];
93
94 # Skip tests that rely on internet access (mostly to IBM Quantum Experience cloud).
95 # Options defined in qiskit.terra.test.testing_options.py::get_test_options
96 preCheck = ''
97 export QISKIT_TESTS=skip_online
98 '';
99
100 meta = with lib; {
101 description = "Qiskit provider for accessing the quantum devices and simulators at IBMQ";
102 homepage = "https://github.com/Qiskit/qiskit-ibmq-provider";
103 changelog = "https://qiskit.org/documentation/release_notes.html";
104 license = licenses.asl20;
105 maintainers = with maintainers; [ drewrisinger ];
106 };
107}