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