1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 opentelemetry-api,
7 opentelemetry-sdk,
8 pytest-asyncio,
9 pytestCheckHook,
10 pythonOlder,
11 qcs-api-client-common,
12 quil,
13 rustPlatform,
14 darwin,
15 libiconv,
16 syrupy,
17}:
18
19buildPythonPackage rec {
20 pname = "qcs-sdk-python";
21 version = "0.21.4";
22 pyproject = true;
23
24 disabled = pythonOlder "3.8";
25
26 src = fetchFromGitHub {
27 owner = "rigetti";
28 repo = "qcs-sdk-rust";
29 rev = "python/v${version}";
30 hash = "sha256-PIU/JPf4GcTl0LeT+BkzZTRzKUQT2BvNzBWP9+/RCKM=";
31 };
32
33 cargoDeps = rustPlatform.fetchCargoVendor {
34 inherit pname version src;
35 hash = "sha256-j2qEjmmeUy+nqOrklGXW/tsGqNAs2SxuvVPW2ywXlsA=";
36 };
37
38 buildAndTestSubdir = "crates/python";
39
40 build-system = [
41 rustPlatform.cargoSetupHook
42 rustPlatform.maturinBuildHook
43 ];
44
45 dependencies = [
46 qcs-api-client-common
47 quil
48 ];
49
50 optional-dependencies = {
51 tracing-opentelemetry = [ opentelemetry-api ];
52 };
53
54 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
55 darwin.apple_sdk.frameworks.Security
56 darwin.apple_sdk.frameworks.SystemConfiguration
57 libiconv
58 ];
59
60 nativeCheckInputs = [
61 opentelemetry-sdk
62 pytest-asyncio
63 pytestCheckHook
64 syrupy
65 ];
66
67 disabledTests = [
68 "test_compile_program"
69 "test_conjugate_pauli_by_clifford"
70 "test_execute_qvm"
71 "test_generate_randomized_benchmark_sequence"
72 "test_get_report"
73 "test_get_version_info"
74 "test_list_quantum_processors_timeout"
75 ];
76
77 meta = {
78 changelog = "https://github.com/rigetti/qcs-sdk-rust/blob/${src.rev}/crates/python/CHANGELOG.md";
79 description = "Python interface for the QCS Rust SDK";
80 homepage = "https://github.com/rigetti/qcs-sdk-rust/tree/main/crates/python";
81 license = lib.licenses.asl20;
82 maintainers = with lib.maintainers; [ dotlambda ];
83 };
84}