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, pythonOlder
16, qcs-api-client
17, respx
18, retry
19, rpcq
20, scipy
21, types-python-dateutil
22, types-retry
23}:
24
25buildPythonPackage rec {
26 pname = "pyquil";
27 version = "3.3.2";
28 format = "pyproject";
29
30 disabled = pythonOlder "3.7";
31
32 src = fetchFromGitHub {
33 owner = "rigetti";
34 repo = pname;
35 rev = "v${version}";
36 hash = "sha256-Ur7dRxmnaAWXHk7c6NC3lBw59RRgh9vwAHFW00fViD4=";
37 };
38
39 nativeBuildInputs = [
40 poetry-core
41 ];
42
43 propagatedBuildInputs = [
44 lark
45 networkx
46 numpy
47 qcs-api-client
48 retry
49 rpcq
50 scipy
51 types-python-dateutil
52 types-retry
53 ] ++ lib.optionals (pythonOlder "3.8") [
54 importlib-metadata
55 ];
56
57 checkInputs = [
58 pytest-asyncio
59 pytest-freezegun
60 pytest-httpx
61 pytest-mock
62 pytestCheckHook
63 respx
64 ipython
65 ];
66
67 postPatch = ''
68 substituteInPlace pyproject.toml \
69 --replace 'lark = "^0.11.1"' 'lark = "*"' \
70 --replace 'qcs-api-client = ">=0.8.1,<0.21.0"' 'qcs-api-client = "*"'
71 '';
72
73 disabledTestPaths = [
74 # Tests require network access
75 "test/e2e/"
76 "test/unit/test_api.py"
77 "test/unit/test_engagement_manager.py"
78 "test/unit/test_operator_estimation.py"
79 "test/unit/test_wavefunction_simulator.py"
80 "test/unit/test_compatibility_v2_operator_estimation.py"
81 "test/unit/test_compatibility_v2_quantum_computer.py"
82 "test/unit/test_compatibility_v2_qvm.py"
83 "test/unit/test_quantum_computer.py"
84 "test/unit/test_qvm.py"
85 "test/unit/test_reference_wavefunction.py"
86 # Out-dated
87 "test/unit/test_qpu_client.py"
88 ];
89
90 disabledTests = [
91 "test_compile_with_quilt_calibrations"
92 "test_sets_timeout_on_requests"
93 # sensitive to lark parser output
94 "test_memory_commands"
95 "test_classical"
96 ];
97
98 pythonImportsCheck = [
99 "pyquil"
100 ];
101
102 meta = with lib; {
103 description = "Python library for creating Quantum Instruction Language (Quil) programs";
104 homepage = "https://github.com/rigetti/pyquil";
105 license = licenses.asl20;
106 maintainers = with maintainers; [ fab ];
107 };
108}