1{ lib
2, attrs
3, buildPythonPackage
4, fetchFromGitHub
5, fetchpatch
6, httpx
7, iso8601
8, poetry-core
9, pydantic
10, pyjwt
11, pytest-asyncio
12, pytestCheckHook
13, python-dateutil
14, pythonOlder
15, respx
16, retrying
17, rfc3339
18, toml
19}:
20
21buildPythonPackage rec {
22 pname = "qcs-api-client";
23 version = "0.21.2";
24 format = "pyproject";
25
26 disabled = pythonOlder "3.7";
27
28 src = fetchFromGitHub {
29 owner = "rigetti";
30 repo = "qcs-api-client-python";
31 rev = "refs/tags/v${version}";
32 hash = "sha256-gQow1bNRPhUm4zRu2T5FpcgOTcS2F1TQIz8WP1K0Xww=";
33 };
34
35 nativeBuildInputs = [
36 poetry-core
37 ];
38
39 propagatedBuildInputs = [
40 attrs
41 httpx
42 iso8601
43 pydantic
44 pyjwt
45 python-dateutil
46 retrying
47 rfc3339
48 toml
49 ];
50
51 checkInputs = [
52 pytest-asyncio
53 pytestCheckHook
54 respx
55 ];
56
57 patches = [
58 # Switch to poetry-core, https://github.com/rigetti/qcs-api-client-python/pull/2
59 (fetchpatch {
60 name = "switch-to-poetry-core.patch";
61 url = "https://github.com/rigetti/qcs-api-client-python/commit/32f0b3c7070a65f4edf5b2552648d88435469e44.patch";
62 hash = "sha256-mOc+Q/5cmwPziojtxeEMWWHSDvqvzZlNRbPtOSeTinQ=";
63 })
64 ];
65
66 postPatch = ''
67 substituteInPlace pyproject.toml \
68 --replace 'attrs = "^20.1.0"' 'attrs = "*"' \
69 --replace 'httpx = "^0.15.0"' 'httpx = "*"' \
70 --replace 'iso8601 = "^0.1.13"' 'iso8601 = "*"' \
71 --replace 'pydantic = "^1.7.2"' 'pydantic = "*"' \
72 --replace 'pyjwt = "^1.7.1"' 'pyjwt = "*"'
73 '';
74
75 disabledTestPaths = [
76 # Test is outdated
77 "tests/test_client/test_additional_properties.py"
78 "tests/test_client/test_auth.py"
79 "tests/test_client/test_client.py"
80 "tests/test_client/test_datetime.py"
81 "tests/test_imports.py"
82 ];
83
84 pythonImportsCheck = [
85 "qcs_api_client"
86 ];
87
88 meta = with lib; {
89 description = "Python library for accessing the Rigetti QCS API";
90 homepage = "https://qcs-api-client-python.readthedocs.io/";
91 license = licenses.asl20;
92 maintainers = with maintainers; [ fab ];
93 };
94}