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