summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/qcs-api-client-common/default.nix
blob: 8d6f221a3879f9ced193a465bd8d1645467cee52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{
  buildPythonPackage,
  cargo,
  fetchFromGitHub,
  grpc-interceptor,
  grpcio,
  httpx,
  lib,
  pytest-asyncio,
  pytest-mock,
  pytestCheckHook,
  pythonAtLeast,
  rustc,
  rustPlatform,
  syrupy,
}:

buildPythonPackage rec {
  pname = "qcs-api-client-common";
  version = "0.11.8";
  pyproject = true;

  # error: the configured Python interpreter version (3.13) is newer than PyO3's maximum supported version (3.12)
  disabled = pythonAtLeast "3.13";

  src = fetchFromGitHub {
    owner = "rigetti";
    repo = "qcs-api-client-rust";
    tag = "common/v${version}";
    hash = "sha256-IJaclIGuLWyTaVnnK1MblSZjIqjaMjLCFfY1CLn6Rao=";
  };

  cargoDeps = rustPlatform.fetchCargoVendor {
    inherit pname version src;
    hash = "sha256-luLg4VR7Nwm6g1UYckKmN9iy1MvNezYh9g21ADMX/yU=";
  };

  buildAndTestSubdir = "qcs-api-client-common";

  nativeBuildInputs = [
    cargo
    rustPlatform.cargoSetupHook
    rustPlatform.maturinBuildHook
    rustc
  ];

  dependencies = [
    grpc-interceptor
    grpcio
    httpx
  ];

  preCheck = ''
    cd ${buildAndTestSubdir}
    # import from $out
    rm -r qcs_api_client_common
  '';

  nativeCheckInputs = [
    pytest-asyncio
    pytest-mock
    pytestCheckHook
    syrupy
  ];

  meta = {
    changelog = "https://github.com/rigetti/qcs-api-client-rust/blob/${src.tag}/qcs-api-client-common/CHANGELOG-py.md";
    description = "Contains core QCS client functionality and middleware implementations";
    homepage = "https://github.com/rigetti/qcs-api-client-rust/tree/main/qcs-api-client-common";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ dotlambda ];
  };
}