1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, fetchpatch
5, importlib-metadata
6, ipython
7, lark-parser
8, networkx
9, numpy
10, poetry-core
11, pytest-asyncio
12, pytest-freezegun
13, pytest-httpx
14, pytest-mock
15, pytestCheckHook
16, pythonOlder
17, qcs-api-client
18, retry
19, respx
20, rpcq
21, scipy
22}:
23
24buildPythonPackage rec {
25 pname = "pyquil";
26 version = "3.0.1";
27 format = "pyproject";
28
29 disabled = pythonOlder "3.7";
30
31 src = fetchFromGitHub {
32 owner = "rigetti";
33 repo = pname;
34 rev = "v${version}";
35 sha256 = "sha256-OU7/LjcpCxvqlcfdlm5ll4f0DYXf0yxNprM8Muu2wyg=";
36 };
37
38 patches = [
39 (fetchpatch {
40 name = "pyquil-pr-1404-unpin-qcs-api-client-version-pyproject.patch";
41 url = "https://github.com/rigetti/pyquil/commit/2e35a4fdf65262fdf39c5091aeddfa3f3564925a.patch";
42 sha256 = "sha256-KGDNU2wpzsuifQSbbkoMwaFXspHW6zyIJ5GRZbw+lUY=";
43 })
44 ];
45
46 nativeBuildInputs = [
47 poetry-core
48 ];
49
50 propagatedBuildInputs = [
51 lark-parser
52 networkx
53 numpy
54 qcs-api-client
55 retry
56 rpcq
57 scipy
58 ] ++ lib.optionals (pythonOlder "3.8") [
59 importlib-metadata
60 ];
61
62 checkInputs = [
63 pytest-asyncio
64 pytest-freezegun
65 pytest-httpx
66 pytest-mock
67 pytestCheckHook
68 respx
69 ipython
70 ];
71
72 postPatch = ''
73 substituteInPlace pyproject.toml \
74 --replace 'lark = "^0.11.1"' 'lark-parser = ">=0.11.1"'
75 '';
76
77 disabledTestPaths = [
78 # Tests require network access
79 "test/e2e/"
80 "test/unit/test_api.py"
81 "test/unit/test_engagement_manager.py"
82 "test/unit/test_operator_estimation.py"
83 "test/unit/test_wavefunction_simulator.py"
84 "test/unit/test_compatibility_v2_operator_estimation.py"
85 "test/unit/test_compatibility_v2_quantum_computer.py"
86 "test/unit/test_compatibility_v2_qvm.py"
87 "test/unit/test_quantum_computer.py"
88 "test/unit/test_qvm.py"
89 "test/unit/test_reference_wavefunction.py"
90 ];
91
92 disabledTests = [
93 "test_compile_with_quilt_calibrations"
94 "test_sets_timeout_on_requests"
95 ];
96
97 pythonImportsCheck = [ "pyquil" ];
98
99 meta = with lib; {
100 description = "Python library for creating Quantum Instruction Language (Quil) programs";
101 homepage = "https://github.com/rigetti/pyquil";
102 license = licenses.asl20;
103 maintainers = with maintainers; [ fab ];
104 };
105}