diff --git a/python-qcs-api-client.changes b/python-qcs-api-client.changes index f4b7312..7bb56bd 100644 --- a/python-qcs-api-client.changes +++ b/python-qcs-api-client.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Sun Jan 29 15:02:25 UTC 2023 - Ben Greiner + +- Update to 0.21.3 + * Chore: QCS Schema + * Upgrade: attrs 21 + * Update: httpx to 0.23.0 +- Fix switch-to-pyrfc39999.patch: format datetime objects as + strings, not parse them! +- Drop support-new-respx.patch + ------------------------------------------------------------------- Fri Aug 19 06:26:01 UTC 2022 - Steve Kowalik diff --git a/python-qcs-api-client.spec b/python-qcs-api-client.spec index 3798684..71f75e3 100644 --- a/python-qcs-api-client.spec +++ b/python-qcs-api-client.spec @@ -1,7 +1,7 @@ # # spec file for package python-qcs-api-client # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,9 +16,8 @@ # -%{?!python_module:%define python_module() python3-%{**}} Name: python-qcs-api-client -Version: 0.21.1 +Version: 0.21.3 Release: 0 Summary: Python client library for accessing the Rigetti QCS API License: MIT @@ -26,32 +25,36 @@ URL: https://github.com/rigetti/qcs-api-client-python Source: https://github.com/rigetti/qcs-api-client-python/archive/refs/tags/v%{version}.tar.gz#/qcs-api-client-%{version}.tar.gz # PATCH-FIX-OPENSUSE Use pyRFC3339 rather than rfc3339 which is not packaged Patch0: switch-to-pyrfc3339.patch -# PATCH-FIX-OPENSUSE Support newer respx -Patch1: support-new-respx.patch -BuildRequires: %{python_module PyJWT} -BuildRequires: %{python_module dateutil} -BuildRequires: %{python_module httpx} +BuildRequires: %{python_module base >= 3.7} BuildRequires: %{python_module pip} -BuildRequires: %{python_module poetry} -BuildRequires: %{python_module pyRFC3339} -BuildRequires: %{python_module pydantic} -BuildRequires: %{python_module pytest-asyncio} -BuildRequires: %{python_module pytest} -BuildRequires: %{python_module respx} -BuildRequires: %{python_module retrying} -BuildRequires: %{python_module setuptools} -BuildRequires: %{python_module toml} +BuildRequires: %{python_module poetry-core} BuildRequires: fdupes BuildRequires: python-rpm-macros -Requires: python-PyJWT -Requires: python-attrs >= 20.1 +# SECTION runtime +BuildRequires: %{python_module PyJWT >= 2.4.0} +BuildRequires: %{python_module attrs >= 21.3} +BuildRequires: %{python_module dateutil} +BuildRequires: %{python_module httpx} +BuildRequires: %{python_module iso8601 >= 1.0.2} +BuildRequires: %{python_module pyRFC3339 >= 1.1} +BuildRequires: %{python_module pydantic} +BuildRequires: %{python_module retrying} +BuildRequires: %{python_module toml >= 0.10.2} +# /SECTION +# SECTION test +BuildRequires: %{python_module pytest-asyncio} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module respx >= 0.20} +# /SECTION +Requires: python-PyJWT >= 2.4.0 +Requires: python-attrs >= 21.3 Requires: python-dateutil >= 2.8.1 -Requires: python-httpx >= 0.15 +Requires: python-httpx >= 0.23 Requires: python-iso8601 >= 1.0.2 -Requires: python-pyRFC3339 +Requires: python-pyRFC3339 >= 1.1 Requires: python-pydantic >= 1.7.2 -Requires: python-retrying >= 1.3 -Requires: python-toml +Requires: python-retrying >= 1.3.3 +Requires: python-toml >= 0.10.2 BuildArch: noarch %python_subpackages diff --git a/qcs-api-client-0.21.1.tar.gz b/qcs-api-client-0.21.1.tar.gz deleted file mode 100644 index 09ed5a9..0000000 --- a/qcs-api-client-0.21.1.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7163bdc078702b9e3aae348b70195c5e8a9620d221b9f05c70b130c4b78ca223 -size 66741 diff --git a/qcs-api-client-0.21.3.tar.gz b/qcs-api-client-0.21.3.tar.gz new file mode 100644 index 0000000..ca515df --- /dev/null +++ b/qcs-api-client-0.21.3.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f1491ae63d46e05e9fd8f2349936fef45071a296b84dddb73115e5f23f1434a4 +size 69904 diff --git a/support-new-respx.patch b/support-new-respx.patch deleted file mode 100644 index 5b226c6..0000000 --- a/support-new-respx.patch +++ /dev/null @@ -1,76 +0,0 @@ -Index: qcs-api-client-python-0.21.0/tests/test_client/test_auth.py -=================================================================== ---- qcs-api-client-python-0.21.0.orig/tests/test_client/test_auth.py -+++ qcs-api-client-python-0.21.0/tests/test_client/test_auth.py -@@ -1,4 +1,5 @@ - from pathlib import Path -+import httpx - import respx - import pytest - import asyncio -@@ -18,7 +19,7 @@ from qcs_api_client.client._configuratio - ], - ) - @respx.mock(assert_all_mocked=True) --def test_qcs_auth_refresh_token(fixture_directory: Path, execute_async: bool, respx_mock: respx.MockTransport = None): -+def test_qcs_auth_refresh_token(fixture_directory: Path, execute_async: bool, respx_mock: httpx.MockTransport = None): - """ - Assert that the credential's token payload is written back to the file on update during the - QCSAuth refresh flows. -Index: qcs-api-client-python-0.21.0/tests/test_client/test_client.py -=================================================================== ---- qcs-api-client-python-0.21.0.orig/tests/test_client/test_client.py -+++ qcs-api-client-python-0.21.0/tests/test_client/test_client.py -@@ -5,6 +5,7 @@ from unittest.mock import create_autospe - - import pytest - import respx -+import httpx - from httpx import Request, Response - from typing import cast - from qcs_api_client.client import build_async_client, build_sync_client -@@ -129,7 +130,7 @@ def test_env_overrides(monkeypatch): - - - @respx.mock(assert_all_mocked=True) --def test_sync_client(client_configuration: QCSClientConfiguration, respx_mock: respx.MockTransport = None): -+def test_sync_client(client_configuration: QCSClientConfiguration, respx_mock: httpx.MockTransport = None): - """ - Assert that a sync client can be constructed and make a call with authorization header. - """ -@@ -144,7 +145,7 @@ def test_sync_client(client_configuratio - - - @respx.mock(assert_all_mocked=True) --def test_sync_client_api_call(client_configuration: QCSClientConfiguration, respx_mock: respx.MockTransport = None): -+def test_sync_client_api_call(client_configuration: QCSClientConfiguration, respx_mock: httpx.MockTransport = None): - """Assert that a generated request function can be called with a sync client.""" - - def assert_request(request: Request): -@@ -159,7 +160,7 @@ def test_sync_client_api_call(client_con - - - @respx.mock(assert_all_mocked=True) --def test_sync_client_api_call_empty_config(fixture_directory: Path, respx_mock: respx.MockTransport = None): -+def test_sync_client_api_call_empty_config(fixture_directory: Path, respx_mock: httpx.MockTransport = None): - """Assert that the client makes sync requests with authentication if configuration is empty.""" - - client_configuration = QCSClientConfiguration.load( -@@ -184,7 +185,7 @@ def test_sync_client_api_call_empty_conf - - @respx.mock(assert_all_mocked=True) - @pytest.mark.asyncio --async def test_async_client(client_configuration: QCSClientConfiguration, respx_mock: respx.MockTransport = None): -+async def test_async_client(client_configuration: QCSClientConfiguration, respx_mock: httpx.MockTransport = None): - """ - Assert that an async client can be constructed and make a call with authorization header. - """ -@@ -198,7 +199,7 @@ async def test_async_client(client_confi - - - @respx.mock(assert_all_mocked=True) --async def test_async_client_api_call_empty_config(fixture_directory: Path, respx_mock: respx.MockTransport = None): -+async def test_async_client_api_call_empty_config(fixture_directory: Path, respx_mock: httpx.MockTransport = None): - """Assert that the client makes async requests with authentication if configuration is empty.""" - - client_configuration = QCSClientConfiguration.load( diff --git a/switch-to-pyrfc3339.patch b/switch-to-pyrfc3339.patch index 9dfe969..f9651fc 100644 --- a/switch-to-pyrfc3339.patch +++ b/switch-to-pyrfc3339.patch @@ -1,13 +1,13 @@ -Index: qcs-api-client-python-0.21.0/qcs_api_client/api/reservations/find_available_reservations.py +Index: qcs-api-client-python-0.21.3/qcs_api_client/api/reservations/find_available_reservations.py =================================================================== ---- qcs-api-client-python-0.21.0.orig/qcs_api_client/api/reservations/find_available_reservations.py -+++ qcs-api-client-python-0.21.0/qcs_api_client/api/reservations/find_available_reservations.py +--- qcs-api-client-python-0.21.3.orig/qcs_api_client/api/reservations/find_available_reservations.py ++++ qcs-api-client-python-0.21.3/qcs_api_client/api/reservations/find_available_reservations.py @@ -3,7 +3,7 @@ from typing import Any, Dict import httpx from retrying import retry -from rfc3339 import rfc3339 -+from pyrfc3339 import parse ++from pyrfc3339 import generate from ...models.find_available_reservations_response import FindAvailableReservationsResponse from ...types import UNSET, Response @@ -16,20 +16,20 @@ Index: qcs-api-client-python-0.21.0/qcs_api_client/api/reservations/find_availab assert start_time_from.tzinfo is not None, "Datetime must have timezone information" - json_start_time_from = rfc3339(start_time_from) -+ json_start_time_from = parse(start_time_from) ++ json_start_time_from = generate(start_time_from) params["startTimeFrom"] = json_start_time_from -Index: qcs-api-client-python-0.21.0/qcs_api_client/models/available_reservation.py +Index: qcs-api-client-python-0.21.3/qcs_api_client/models/available_reservation.py =================================================================== ---- qcs-api-client-python-0.21.0.orig/qcs_api_client/models/available_reservation.py -+++ qcs-api-client-python-0.21.0/qcs_api_client/models/available_reservation.py +--- qcs-api-client-python-0.21.3.orig/qcs_api_client/models/available_reservation.py ++++ qcs-api-client-python-0.21.3/qcs_api_client/models/available_reservation.py @@ -3,7 +3,7 @@ from typing import Any, Callable, Dict, import attr from dateutil.parser import isoparse -from rfc3339 import rfc3339 -+from pyrfc3339 import parse ++from pyrfc3339 import generate from ..types import UNSET from ..util.serialization import is_not_none @@ -38,26 +38,26 @@ Index: qcs-api-client-python-0.21.0/qcs_api_client/models/available_reservation. duration = self.duration assert self.end_time.tzinfo is not None, "Datetime must have timezone information" - end_time = rfc3339(self.end_time) -+ end_time = parse(self.end_time) ++ end_time = generate(self.end_time) price = self.price quantum_processor_id = self.quantum_processor_id assert self.start_time.tzinfo is not None, "Datetime must have timezone information" - start_time = rfc3339(self.start_time) -+ start_time = parse(self.start_time) ++ start_time = generate(self.start_time) field_dict: Dict[str, Any] = {} field_dict.update(self.additional_properties) -Index: qcs-api-client-python-0.21.0/qcs_api_client/models/billing_invoice.py +Index: qcs-api-client-python-0.21.3/qcs_api_client/models/billing_invoice.py =================================================================== ---- qcs-api-client-python-0.21.0.orig/qcs_api_client/models/billing_invoice.py -+++ qcs-api-client-python-0.21.0/qcs_api_client/models/billing_invoice.py +--- qcs-api-client-python-0.21.3.orig/qcs_api_client/models/billing_invoice.py ++++ qcs-api-client-python-0.21.3/qcs_api_client/models/billing_invoice.py @@ -3,7 +3,7 @@ from typing import Any, Callable, Dict, import attr from dateutil.parser import isoparse -from rfc3339 import rfc3339 -+from pyrfc3339 import parse ++from pyrfc3339 import generate from ..models.billing_invoice_status import BillingInvoiceStatus from ..types import UNSET @@ -66,24 +66,24 @@ Index: qcs-api-client-python-0.21.0/qcs_api_client/models/billing_invoice.py def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: assert self.period_end.tzinfo is not None, "Datetime must have timezone information" - period_end = rfc3339(self.period_end) -+ period_end = parse(self.period_end) ++ period_end = generate(self.period_end) assert self.period_start.tzinfo is not None, "Datetime must have timezone information" - period_start = rfc3339(self.period_start) -+ period_start = parse(self.period_start) ++ period_start = generate(self.period_start) starting_balance = self.starting_balance status = self.status.value -Index: qcs-api-client-python-0.21.0/qcs_api_client/models/billing_upcoming_invoice.py +Index: qcs-api-client-python-0.21.3/qcs_api_client/models/billing_upcoming_invoice.py =================================================================== ---- qcs-api-client-python-0.21.0.orig/qcs_api_client/models/billing_upcoming_invoice.py -+++ qcs-api-client-python-0.21.0/qcs_api_client/models/billing_upcoming_invoice.py +--- qcs-api-client-python-0.21.3.orig/qcs_api_client/models/billing_upcoming_invoice.py ++++ qcs-api-client-python-0.21.3/qcs_api_client/models/billing_upcoming_invoice.py @@ -3,7 +3,7 @@ from typing import Any, Callable, Dict, import attr from dateutil.parser import isoparse -from rfc3339 import rfc3339 -+from pyrfc3339 import parse ++from pyrfc3339 import generate from ..models.billing_invoice_status import BillingInvoiceStatus from ..types import UNSET @@ -92,24 +92,24 @@ Index: qcs-api-client-python-0.21.0/qcs_api_client/models/billing_upcoming_invoi def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: assert self.period_end.tzinfo is not None, "Datetime must have timezone information" - period_end = rfc3339(self.period_end) -+ period_end = parse(self.period_end) ++ period_end = generate(self.period_end) assert self.period_start.tzinfo is not None, "Datetime must have timezone information" - period_start = rfc3339(self.period_start) -+ period_start = parse(self.period_start) ++ period_start = generate(self.period_start) starting_balance = self.starting_balance status = self.status.value -Index: qcs-api-client-python-0.21.0/qcs_api_client/models/characteristic.py +Index: qcs-api-client-python-0.21.3/qcs_api_client/models/characteristic.py =================================================================== ---- qcs-api-client-python-0.21.0.orig/qcs_api_client/models/characteristic.py -+++ qcs-api-client-python-0.21.0/qcs_api_client/models/characteristic.py +--- qcs-api-client-python-0.21.3.orig/qcs_api_client/models/characteristic.py ++++ qcs-api-client-python-0.21.3/qcs_api_client/models/characteristic.py @@ -3,7 +3,7 @@ from typing import Any, Callable, Dict, import attr from dateutil.parser import isoparse -from rfc3339 import rfc3339 -+from pyrfc3339 import parse ++from pyrfc3339 import generate from ..types import UNSET, Unset from ..util.serialization import is_not_none @@ -118,20 +118,20 @@ Index: qcs-api-client-python-0.21.0/qcs_api_client/models/characteristic.py name = self.name assert self.timestamp.tzinfo is not None, "Datetime must have timezone information" - timestamp = rfc3339(self.timestamp) -+ timestamp = parse(self.timestamp) ++ timestamp = generate(self.timestamp) value = self.value error = self.error -Index: qcs-api-client-python-0.21.0/qcs_api_client/models/create_reservation_request.py +Index: qcs-api-client-python-0.21.3/qcs_api_client/models/create_reservation_request.py =================================================================== ---- qcs-api-client-python-0.21.0.orig/qcs_api_client/models/create_reservation_request.py -+++ qcs-api-client-python-0.21.0/qcs_api_client/models/create_reservation_request.py +--- qcs-api-client-python-0.21.3.orig/qcs_api_client/models/create_reservation_request.py ++++ qcs-api-client-python-0.21.3/qcs_api_client/models/create_reservation_request.py @@ -3,7 +3,7 @@ from typing import Any, Callable, Dict, import attr from dateutil.parser import isoparse -from rfc3339 import rfc3339 -+from pyrfc3339 import parse ++from pyrfc3339 import generate from ..models.account_type import AccountType from ..types import UNSET, Unset @@ -140,25 +140,25 @@ Index: qcs-api-client-python-0.21.0/qcs_api_client/models/create_reservation_req def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: assert self.end_time.tzinfo is not None, "Datetime must have timezone information" - end_time = rfc3339(self.end_time) -+ end_time = parse(self.end_time) ++ end_time = generate(self.end_time) quantum_processor_id = self.quantum_processor_id assert self.start_time.tzinfo is not None, "Datetime must have timezone information" - start_time = rfc3339(self.start_time) -+ start_time = parse(self.start_time) ++ start_time = generate(self.start_time) account_id = self.account_id account_type: Union[Unset, str] = UNSET -Index: qcs-api-client-python-0.21.0/qcs_api_client/models/group.py +Index: qcs-api-client-python-0.21.3/qcs_api_client/models/group.py =================================================================== ---- qcs-api-client-python-0.21.0.orig/qcs_api_client/models/group.py -+++ qcs-api-client-python-0.21.0/qcs_api_client/models/group.py +--- qcs-api-client-python-0.21.3.orig/qcs_api_client/models/group.py ++++ qcs-api-client-python-0.21.3/qcs_api_client/models/group.py @@ -3,7 +3,7 @@ from typing import Any, Callable, Dict, import attr from dateutil.parser import isoparse -from rfc3339 import rfc3339 -+from pyrfc3339 import parse ++from pyrfc3339 import generate from ..types import UNSET from ..util.serialization import is_not_none @@ -167,31 +167,31 @@ Index: qcs-api-client-python-0.21.0/qcs_api_client/models/group.py def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: assert self.created_time.tzinfo is not None, "Datetime must have timezone information" - created_time = rfc3339(self.created_time) -+ created_time = parse(self.created_time) ++ created_time = generate(self.created_time) description = self.description id = self.id assert self.last_membership_updated_time.tzinfo is not None, "Datetime must have timezone information" - last_membership_updated_time = rfc3339(self.last_membership_updated_time) -+ last_membership_updated_time = parse(self.last_membership_updated_time) ++ last_membership_updated_time = generate(self.last_membership_updated_time) name = self.name assert self.updated_time.tzinfo is not None, "Datetime must have timezone information" - updated_time = rfc3339(self.updated_time) -+ updated_time = parse(self.updated_time) ++ updated_time = generate(self.updated_time) field_dict: Dict[str, Any] = {} field_dict.update(self.additional_properties) -Index: qcs-api-client-python-0.21.0/qcs_api_client/models/reservation.py +Index: qcs-api-client-python-0.21.3/qcs_api_client/models/reservation.py =================================================================== ---- qcs-api-client-python-0.21.0.orig/qcs_api_client/models/reservation.py -+++ qcs-api-client-python-0.21.0/qcs_api_client/models/reservation.py +--- qcs-api-client-python-0.21.3.orig/qcs_api_client/models/reservation.py ++++ qcs-api-client-python-0.21.3/qcs_api_client/models/reservation.py @@ -3,7 +3,7 @@ from typing import Any, Callable, Dict, import attr from dateutil.parser import isoparse -from rfc3339 import rfc3339 -+from pyrfc3339 import parse ++from pyrfc3339 import generate from ..models.account_type import AccountType from ..types import UNSET, Unset @@ -200,18 +200,18 @@ Index: qcs-api-client-python-0.21.0/qcs_api_client/models/reservation.py assert self.created_time.tzinfo is not None, "Datetime must have timezone information" - created_time = rfc3339(self.created_time) -+ created_time = parse(self.created_time) ++ created_time = generate(self.created_time) assert self.end_time.tzinfo is not None, "Datetime must have timezone information" - end_time = rfc3339(self.end_time) -+ end_time = parse(self.end_time) ++ end_time = generate(self.end_time) id = self.id price = self.price quantum_processor_id = self.quantum_processor_id assert self.start_time.tzinfo is not None, "Datetime must have timezone information" - start_time = rfc3339(self.start_time) -+ start_time = parse(self.start_time) ++ start_time = generate(self.start_time) user_id = self.user_id cancellation_billing_invoice_item_id = self.cancellation_billing_invoice_item_id @@ -220,20 +220,20 @@ Index: qcs-api-client-python-0.21.0/qcs_api_client/models/reservation.py updated_time: Union[Unset, str] = UNSET if not isinstance(self.updated_time, Unset): - updated_time = rfc3339(self.updated_time) -+ updated_time = parse(self.updated_time) ++ updated_time = generate(self.updated_time) field_dict: Dict[str, Any] = {} field_dict.update(self.additional_properties) -Index: qcs-api-client-python-0.21.0/qcs_api_client/models/user.py +Index: qcs-api-client-python-0.21.3/qcs_api_client/models/user.py =================================================================== ---- qcs-api-client-python-0.21.0.orig/qcs_api_client/models/user.py -+++ qcs-api-client-python-0.21.0/qcs_api_client/models/user.py +--- qcs-api-client-python-0.21.3.orig/qcs_api_client/models/user.py ++++ qcs-api-client-python-0.21.3/qcs_api_client/models/user.py @@ -3,7 +3,7 @@ from typing import Any, Callable, Dict, import attr from dateutil.parser import isoparse -from rfc3339 import rfc3339 -+from pyrfc3339 import parse ++from pyrfc3339 import generate from ..models.user_profile import UserProfile from ..types import UNSET, Unset @@ -242,7 +242,28 @@ Index: qcs-api-client-python-0.21.0/qcs_api_client/models/user.py def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: assert self.created_time.tzinfo is not None, "Datetime must have timezone information" - created_time = rfc3339(self.created_time) -+ created_time = parse(self.created_time) ++ created_time = generate(self.created_time) id = self.id idp_id = self.idp_id +Index: qcs-api-client-python-0.21.3/pyproject.toml +=================================================================== +--- qcs-api-client-python-0.21.3.orig/pyproject.toml ++++ qcs-api-client-python-0.21.3/pyproject.toml +@@ -21,7 +21,7 @@ pydantic = "^1.7.2" + python = "^3.7" + python-dateutil = "^2.8.1" + retrying = "^1.3.3" +-rfc3339 = "^6.2" ++pyRFC3339 = "^1.1" + toml = "^0.10.2" + PyJWT = "^2.4.0" + +@@ -53,5 +53,5 @@ multi_line_output = 3 + include_trailing_comma = true + + [build-system] +-requires = ["poetry>=1.0"] +-build-backend = "poetry.masonry.api" ++requires = ["poetry-core"] ++build-backend = "poetry.core.masonry.api"