1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, importlib-metadata
5, ipython
6, lark
7, networkx
8, numpy
9, poetry-core
10, pytest-asyncio
11, pytest-freezegun
12, pytest-httpx
13, pytest-mock
14, pytestCheckHook
15, pythonAtLeast
16, pythonOlder
17, pythonRelaxDepsHook
18, qcs-api-client
19, respx
20, retry
21, rpcq
22, scipy
23, types-python-dateutil
24, types-retry
25}:
26
27buildPythonPackage rec {
28 pname = "pyquil";
29 version = "3.5.0";
30 format = "pyproject";
31
32 disabled = pythonOlder "3.7";
33
34 src = fetchFromGitHub {
35 owner = "rigetti";
36 repo = pname;
37 rev = "refs/tags/v${version}";
38 hash = "sha256-Fr9SnAzDHaSKp0AYra/gCZOJ5Fzcx1EO56ahZQZP2Ss=";
39 };
40
41 pythonRelaxDeps = [
42 "lark"
43 "networkx"
44 ];
45
46 nativeBuildInputs = [
47 poetry-core
48 pythonRelaxDepsHook
49 ];
50
51 propagatedBuildInputs = [
52 lark
53 networkx
54 numpy
55 qcs-api-client
56 retry
57 rpcq
58 scipy
59 types-python-dateutil
60 types-retry
61 ] ++ lib.optionals (pythonOlder "3.8") [
62 importlib-metadata
63 ];
64
65 nativeCheckInputs = [
66 pytestCheckHook
67 ];
68
69 checkInputs = [
70 pytest-asyncio
71 pytest-freezegun
72 pytest-httpx
73 pytest-mock
74 respx
75 ipython
76 ];
77
78 disabledTestPaths = [
79 # Tests require network access
80 "test/e2e/"
81 "test/unit/test_api.py"
82 "test/unit/test_engagement_manager.py"
83 "test/unit/test_operator_estimation.py"
84 "test/unit/test_wavefunction_simulator.py"
85 "test/unit/test_compatibility_v2_operator_estimation.py"
86 "test/unit/test_compatibility_v2_quantum_computer.py"
87 "test/unit/test_compatibility_v2_qvm.py"
88 "test/unit/test_quantum_computer.py"
89 "test/unit/test_qvm.py"
90 "test/unit/test_reference_wavefunction.py"
91 # Out-dated
92 "test/unit/test_qpu_client.py"
93 "test/unit/test_qvm_client.py"
94 "test/unit/test_reference_density.py"
95 ];
96
97 disabledTests = [
98 "test_compile_with_quilt_calibrations"
99 "test_sets_timeout_on_requests"
100 # sensitive to lark parser output
101 "test_memory_commands"
102 "test_classical"
103 ];
104
105 pythonImportsCheck = [
106 "pyquil"
107 ];
108
109 meta = with lib; {
110 description = "Python library for creating Quantum Instruction Language (Quil) programs";
111 homepage = "https://github.com/rigetti/pyquil";
112 changelog = "https://github.com/rigetti/pyquil/blob/v${version}/CHANGELOG.md";
113 license = licenses.asl20;
114 maintainers = with maintainers; [ fab ];
115 };
116}