diff --git a/pkgs/development/python-modules/cirq-google/default.nix b/pkgs/development/python-modules/cirq-google/default.nix index 5c8306c27fe9..4aa20a237110 100644 --- a/pkgs/development/python-modules/cirq-google/default.nix +++ b/pkgs/development/python-modules/cirq-google/default.nix @@ -15,7 +15,6 @@ buildPythonPackage rec { postPatch = '' substituteInPlace requirements.txt \ - --replace "protobuf~=3.13.0" "protobuf" \ --replace "google-api-core[grpc] >= 1.14.0, < 2.0.0dev" "google-api-core[grpc] >= 1.14.0, < 3.0.0dev" ''; @@ -29,4 +28,10 @@ buildPythonPackage rec { freezegun pytestCheckHook ]; + + disabledTests = [ + # unittest.mock.InvalidSpecError: Cannot autospec attr 'QuantumEngineServiceClient' + "test_get_engine_sampler_explicit_project_id" + "test_get_engine_sampler" + ]; } diff --git a/pkgs/development/python-modules/cirq-rigetti/default.nix b/pkgs/development/python-modules/cirq-rigetti/default.nix index 662eaef5579b..70333fb47a9a 100644 --- a/pkgs/development/python-modules/cirq-rigetti/default.nix +++ b/pkgs/development/python-modules/cirq-rigetti/default.nix @@ -40,7 +40,9 @@ buildPythonPackage rec { --replace "httpx~=0.15.5" "httpx" \ --replace "idna~=2.10" "idna" \ --replace "pyjwt~=1.7.1" "pyjwt" \ - --replace "qcs-api-client~=0.8.0" "qcs-api-client" + --replace "qcs-api-client~=0.8.0" "qcs-api-client" \ + --replace "iso8601~=0.1.14" "iso8601" \ + --replace "pydantic~=1.8.2" "pydantic" # Remove outdated test rm cirq_rigetti/service_test.py ''; diff --git a/pkgs/development/python-modules/qcs-api-client/default.nix b/pkgs/development/python-modules/qcs-api-client/default.nix index 8fd24d957ca7..49c1c993e32e 100644 --- a/pkgs/development/python-modules/qcs-api-client/default.nix +++ b/pkgs/development/python-modules/qcs-api-client/default.nix @@ -1,9 +1,11 @@ { lib , attrs , buildPythonPackage -, fetchPypi +, fetchFromGitHub +, fetchpatch , httpx , iso8601 +, poetry-core , pydantic , pyjwt , pytest-asyncio @@ -19,15 +21,21 @@ buildPythonPackage rec { pname = "qcs-api-client"; version = "0.20.9"; - format = "setuptools"; + format = "pyproject"; disabled = pythonOlder "3.7"; - src = fetchPypi { - inherit pname version; - sha256 = "7b4e890ca9d9996060690629eee88db49c5fa4bde520910d48dd20323d1c5574"; + src = fetchFromGitHub { + owner = "rigetti"; + repo = "qcs-api-client-python"; + rev = "v${version}"; + hash = "sha256-bQ+5TZzjxGnNRsENEW/sN7sF6SOcgWl4MFtLekD0D+8="; }; + nativeBuildInputs = [ + poetry-core + ]; + propagatedBuildInputs = [ attrs httpx @@ -46,15 +54,28 @@ buildPythonPackage rec { respx ]; + patches = [ + # Switch to poetry-core, https://github.com/rigetti/qcs-api-client-python/pull/2 + (fetchpatch { + name = "switch-to-poetry-core.patch"; + url = "https://github.com/rigetti/qcs-api-client-python/commit/32f0b3c7070a65f4edf5b2552648d88435469e44.patch"; + sha256 = "sha256-mOc+Q/5cmwPziojtxeEMWWHSDvqvzZlNRbPtOSeTinQ="; + }) + ]; + postPatch = '' - substituteInPlace setup.py \ - --replace "attrs>=20.1.0,<21.0.0" "attrs" \ - --replace "httpx>=0.15.0,<0.16.0" "httpx" \ - --replace "pyjwt>=1.7.1,<2.0.0" "pyjwt" + substituteInPlace pyproject.toml \ + --replace 'attrs = "^20.1.0"' 'attrs = "*"' \ + --replace 'httpx = "^0.15.0"' 'httpx = "*"' \ + --replace 'iso8601 = "^0.1.13"' 'iso8601 = "*"' \ + --replace 'pydantic = "^1.7.2"' 'pydantic = "*"' \ + --replace 'pyjwt = "^1.7.1"' 'pyjwt = "*"' ''; - # Project has no tests - doCheck = false; + disabledTestPaths = [ + # Test is outdated + "tests/test_client/test_client.py" + ]; pythonImportsCheck = [ "qcs_api_client"