nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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.20.12";
24 format = "pyproject";
25
26 disabled = pythonOlder "3.7";
27
28 src = fetchFromGitHub {
29 owner = "rigetti";
30 repo = "qcs-api-client-python";
31 rev = "v${version}";
32 hash = "sha256-4462T2WIBdWjtd51YfslYZOcJg9f0nrSOKTi2ed6WvI=";
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 sha256 = "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_client.py"
78 ];
79
80 pythonImportsCheck = [
81 "qcs_api_client"
82 ];
83
84 meta = with lib; {
85 description = "Python library for accessing the Rigetti QCS API";
86 homepage = "https://pypi.org/project/qcs-api-client/";
87 license = licenses.asl20;
88 maintainers = with maintainers; [ fab ];
89 };
90}