1{
2 lib,
3 attrs,
4 buildPythonPackage,
5 fetchFromGitHub,
6 fetchpatch,
7 httpx,
8 iso8601,
9 poetry-core,
10 pydantic,
11 pydantic-settings,
12 pyjwt,
13 pytest-asyncio,
14 pytestCheckHook,
15 python-dateutil,
16 pythonAtLeast,
17 pythonOlder,
18 pythonRelaxDepsHook,
19 respx,
20 retrying,
21 rfc3339,
22 toml,
23}:
24
25buildPythonPackage rec {
26 pname = "qcs-api-client";
27 version = "0.25.0";
28 pyproject = true;
29
30 disabled = pythonOlder "3.7";
31
32 src = fetchFromGitHub {
33 owner = "rigetti";
34 repo = "qcs-api-client-python";
35 rev = "refs/tags/v${version}";
36 hash = "sha256-dKjiicrPLRlaIwHwSqpY5dBMTzrZD4xfw3h54IN3rh0=";
37 };
38
39 patches = [
40 # Switch to poetry-core, https://github.com/rigetti/qcs-api-client-python/pull/2
41 (fetchpatch {
42 name = "switch-to-poetry-core.patch";
43 url = "https://github.com/rigetti/qcs-api-client-python/commit/32f0b3c7070a65f4edf5b2552648d88435469e44.patch";
44 hash = "sha256-mOc+Q/5cmwPziojtxeEMWWHSDvqvzZlNRbPtOSeTinQ=";
45 })
46 ];
47
48 pythonRelaxDeps = [
49 "attrs"
50 "httpx"
51 "iso8601"
52 "pydantic"
53 ];
54
55 build-system = [ poetry-core ];
56
57 nativeBuildInputs = [ pythonRelaxDepsHook ];
58
59 dependencies = [
60 attrs
61 httpx
62 iso8601
63 pydantic
64 pydantic-settings
65 pyjwt
66 python-dateutil
67 retrying
68 rfc3339
69 toml
70 ];
71
72 nativeCheckInputs = [
73 pytest-asyncio
74 pytestCheckHook
75 respx
76 ];
77
78 # Tests are failing on Python 3.11, Fatal Python error: Aborted
79 doCheck = !(pythonAtLeast "3.11");
80
81 pythonImportsCheck = [ "qcs_api_client" ];
82
83 meta = with lib; {
84 description = "Python library for accessing the Rigetti QCS API";
85 homepage = "https://qcs-api-client-python.readthedocs.io/";
86 changelog = "https://github.com/rigetti/qcs-api-client-python/releases/tag/v${version}";
87 license = licenses.asl20;
88 maintainers = with maintainers; [ fab ];
89 };
90}