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 rustc,
13 rustPlatform,
14 syrupy,
15}:
16
17buildPythonPackage rec {
18 pname = "qcs-api-client-common";
19 version = "0.10.2";
20 pyproject = true;
21
22 src = fetchFromGitHub {
23 owner = "rigetti";
24 repo = "qcs-api-client-rust";
25 rev = "refs/tags/common/v${version}";
26 hash = "sha256-WXTqzdbBZmBj/+mVK/watOuaq/WqKtaMVhp+ogjmhqM=";
27 };
28
29 cargoDeps = rustPlatform.importCargoLock {
30 lockFile = ./Cargo.lock;
31 outputHashes = {
32 "hyper-proxy-0.9.1" = "sha256-P9/qMHfq56rkQoBQF3o/SmbOfcePcFf8yh1YQve3oGM=";
33 };
34 };
35
36 # FIXME use
37 # buildAndTestSubdir = "qcs-api-client-common";
38 # instead, which makes the tests fail
39 postPatch = ''
40 cd qcs-api-client-common
41 '';
42 cargoRoot = "..";
43
44 build-system = [ rustPlatform.maturinBuildHook ];
45
46 nativeBuildInputs = [
47 cargo
48 rustPlatform.cargoSetupHook
49 rustc
50 ];
51
52 dependencies = [
53 grpc-interceptor
54 grpcio
55 httpx
56 ];
57
58 preCheck = ''
59 # import from $out
60 rm -r qcs_api_client_common
61 '';
62
63 nativeCheckInputs = [
64 pytest-asyncio
65 pytest-mock
66 pytestCheckHook
67 syrupy
68 ];
69
70 meta = {
71 changelog = "https://github.com/rigetti/qcs-api-client-rust/blob/${src.rev}/qcs-api-client-common/CHANGELOG-py.md";
72 description = "Contains core QCS client functionality and middleware implementations";
73 homepage = "https://github.com/rigetti/qcs-api-client-rust/tree/main/qcs-api-client-common";
74 license = lib.licenses.asl20;
75 maintainers = with lib.maintainers; [ dotlambda ];
76 };
77}