14
0
2022-08-19 06:26:37 +00:00
committed by Git OBS Bridge
commit 15bc160063
7 changed files with 436 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

View File

@@ -0,0 +1,5 @@
-------------------------------------------------------------------
Fri Aug 19 06:26:01 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
- Initial package for 0.21.1

View File

@@ -0,0 +1,80 @@
#
# spec file for package python-qcs-api-client
#
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?!python_module:%define python_module() python3-%{**}}
Name: python-qcs-api-client
Version: 0.21.1
Release: 0
Summary: Python client library for accessing the Rigetti QCS API
License: MIT
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 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: fdupes
BuildRequires: python-rpm-macros
Requires: python-PyJWT
Requires: python-attrs >= 20.1
Requires: python-dateutil >= 2.8.1
Requires: python-httpx >= 0.15
Requires: python-iso8601 >= 1.0.2
Requires: python-pyRFC3339
Requires: python-pydantic >= 1.7.2
Requires: python-retrying >= 1.3
Requires: python-toml
BuildArch: noarch
%python_subpackages
%description
Allows access to the Rigetti Quantum Computing System API
%prep
%autosetup -p1 -n qcs-api-client-python-%{version}
%build
%pyproject_wheel
%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%pytest --ignore tests/test_client/test_auth.py -k 'not test_sync_client'
%files %{python_files}
%license LICENSE
%doc README.md
%{python_sitelib}/qcs_api_client-%{version}*.dist-info
%{python_sitelib}/qcs_api_client
%changelog

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7163bdc078702b9e3aae348b70195c5e8a9620d221b9f05c70b130c4b78ca223
size 66741

76
support-new-respx.patch Normal file
View File

@@ -0,0 +1,76 @@
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(

248
switch-to-pyrfc3339.patch Normal file
View File

@@ -0,0 +1,248 @@
Index: qcs-api-client-python-0.21.0/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
@@ -3,7 +3,7 @@ from typing import Any, Dict
import httpx
from retrying import retry
-from rfc3339 import rfc3339
+from pyrfc3339 import parse
from ...models.find_available_reservations_response import FindAvailableReservationsResponse
from ...types import UNSET, Response
@@ -27,7 +27,7 @@ def _get_kwargs(
params["quantumProcessorId"] = quantum_processor_id
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)
params["startTimeFrom"] = json_start_time_from
Index: qcs-api-client-python-0.21.0/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
@@ -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 ..types import UNSET
from ..util.serialization import is_not_none
@@ -32,12 +32,12 @@ class AvailableReservation:
def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]:
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)
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)
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
===================================================================
--- 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
@@ -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 ..models.billing_invoice_status import BillingInvoiceStatus
from ..types import UNSET
@@ -39,10 +39,10 @@ class BillingInvoice:
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)
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)
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
===================================================================
--- 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
@@ -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 ..models.billing_invoice_status import BillingInvoiceStatus
from ..types import UNSET
@@ -37,10 +37,10 @@ class BillingUpcomingInvoice:
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)
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)
starting_balance = self.starting_balance
status = self.status.value
Index: qcs-api-client-python-0.21.0/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
@@ -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 ..types import UNSET, Unset
from ..util.serialization import is_not_none
@@ -38,7 +38,7 @@ class Characteristic:
def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]:
name = self.name
assert self.timestamp.tzinfo is not None, "Datetime must have timezone information"
- timestamp = rfc3339(self.timestamp)
+ timestamp = parse(self.timestamp)
value = self.value
error = self.error
Index: qcs-api-client-python-0.21.0/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
@@ -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 ..models.account_type import AccountType
from ..types import UNSET, Unset
@@ -36,11 +36,11 @@ class CreateReservationRequest:
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)
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)
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
===================================================================
--- 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
@@ -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 ..types import UNSET
from ..util.serialization import is_not_none
@@ -33,16 +33,16 @@ class Group:
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)
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)
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)
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
===================================================================
--- 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
@@ -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 ..models.account_type import AccountType
from ..types import UNSET, Unset
@@ -55,16 +55,16 @@ class Reservation:
account_type = self.account_type.value
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)
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)
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)
user_id = self.user_id
cancellation_billing_invoice_item_id = self.cancellation_billing_invoice_item_id
@@ -73,7 +73,7 @@ class Reservation:
notes = self.notes
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)
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
===================================================================
--- 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
@@ -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 ..models.user_profile import UserProfile
from ..types import UNSET, Unset
@@ -30,7 +30,7 @@ class User:
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)
id = self.id
idp_id = self.idp_id