@@ -1,9 +1,11 @@
11{ lib
22, attrs
33, buildPythonPackage
4−, fetchPypi
4+, fetchFromGitHub
5+, fetchpatch
56, httpx
67, iso8601
8+, poetry-core
79, pydantic
810, pyjwt
911, pytest-asyncio
@@ -19,15 +21,21 @@
1921buildPythonPackage rec {
2022 pname = "qcs-api-client";
2123 version = "0.20.9";
22− format = "setuptools";
24+ format = "pyproject";
2325
2426 disabled = pythonOlder "3.7";
2527
26− src = fetchPypi {
27− inherit pname version;
28− sha256 = "7b4e890ca9d9996060690629eee88db49c5fa4bde520910d48dd20323d1c5574";
28+ src = fetchFromGitHub {
29+ owner = "rigetti";
30+ repo = "qcs-api-client-python";
31+ rev = "v${version}";
32+ hash = "sha256-bQ+5TZzjxGnNRsENEW/sN7sF6SOcgWl4MFtLekD0D+8=";
2933 };
3034
35+ nativeBuildInputs = [
36+ poetry-core
37+ ];
38+
3139 propagatedBuildInputs = [
3240 attrs
3341 httpx
@@ -46,15 +54,28 @@ buildPythonPackage rec {
4654 respx
4755 ];
4856
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+
4966 postPatch = ''
50− substituteInPlace setup.py \
51− --replace "attrs>=20.1.0,<21.0.0" "attrs" \
52− --replace "httpx>=0.15.0,<0.16.0" "httpx" \
53− --replace "pyjwt>=1.7.1,<2.0.0" "pyjwt"
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 = "*"'
5473 '';
5574
56− # Project has no tests
57− doCheck = false;
75+ disabledTestPaths = [
76+ # Test is outdated
77+ "tests/test_client/test_client.py"
78+ ];
5879
5980 pythonImportsCheck = [
6081 "qcs_api_client"