1{
2 buildPythonPackage,
3 cargo,
4 fetchFromGitHub,
5 grpc-interceptor,
6 grpcio,
7 httpx,
8 lib,
9 pytest-asyncio,
10 pytest-mock,
11 pytestCheckHook,
12 pythonAtLeast,
13 rustc,
14 rustPlatform,
15 syrupy,
16}:
17
18buildPythonPackage rec {
19 pname = "qcs-api-client-common";
20 version = "0.11.8";
21 pyproject = true;
22
23 # error: the configured Python interpreter version (3.13) is newer than PyO3's maximum supported version (3.12)
24 disabled = pythonAtLeast "3.13";
25
26 src = fetchFromGitHub {
27 owner = "rigetti";
28 repo = "qcs-api-client-rust";
29 tag = "common/v${version}";
30 hash = "sha256-IJaclIGuLWyTaVnnK1MblSZjIqjaMjLCFfY1CLn6Rao=";
31 };
32
33 cargoDeps = rustPlatform.fetchCargoVendor {
34 inherit pname version src;
35 hash = "sha256-luLg4VR7Nwm6g1UYckKmN9iy1MvNezYh9g21ADMX/yU=";
36 };
37
38 buildAndTestSubdir = "qcs-api-client-common";
39
40 nativeBuildInputs = [
41 cargo
42 rustPlatform.cargoSetupHook
43 rustPlatform.maturinBuildHook
44 rustc
45 ];
46
47 dependencies = [
48 grpc-interceptor
49 grpcio
50 httpx
51 ];
52
53 preCheck = ''
54 cd ${buildAndTestSubdir}
55 # import from $out
56 rm -r qcs_api_client_common
57 '';
58
59 nativeCheckInputs = [
60 pytest-asyncio
61 pytest-mock
62 pytestCheckHook
63 syrupy
64 ];
65
66 meta = {
67 changelog = "https://github.com/rigetti/qcs-api-client-rust/blob/${src.tag}/qcs-api-client-common/CHANGELOG-py.md";
68 description = "Contains core QCS client functionality and middleware implementations";
69 homepage = "https://github.com/rigetti/qcs-api-client-rust/tree/main/qcs-api-client-common";
70 license = lib.licenses.asl20;
71 maintainers = with lib.maintainers; [ dotlambda ];
72 };
73}