Skip to content

Commit

Permalink
update changelog + fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Mildophin committed Aug 28, 2024
1 parent 2e6253b commit 9b8fec9
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 23 deletions.
17 changes: 10 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,24 @@

All notable changes to this project will be documented in this file.

## [0.12.0] - 2024-08-28
## [0.12.0] - 2024-08-29

### Breaking change

- 'project' field has completely replaced the deprecated field 'group'
- 'from pasqal_cloud' import has completely replaced the deprecated import 'from sdk'
- 'project' field has completely replaced the deprecated field 'group'
- Now you need to declare the 'project_id' as the first argument when instantiating an SDK class

## [0.11.4] - 2024-07-31
## [0.11.4] - 2024-08-28

### Changed

Batch that do not accept new jobs are now called "closed" instead of "complete". As a result:

- You should create an "open" batch using the "open" argument of the `create_batch` method instead of the `complete` argument.
- Close an open batch using the `close_batch` method of the SDK or `close` method of the `Batch` class. They are functionally equivalent to the now deprecated `complete_batch` and `declare_complete` functions.
- You should create an "open" batch using the "open" argument of the `create_batch` method instead of the `complete`
argument.
- Close an open batch using the `close_batch` method of the SDK or `close` method of the `Batch` class. They are
functionally equivalent to the now deprecated `complete_batch` and `declare_complete` functions.
- Batch dataclass parameter `complete` has been replaced by `open`.
- Using the deprecated method and arguments will now raise a warning .

Expand Down Expand Up @@ -108,8 +111,8 @@ Batch that do not accept new jobs are now called "closed" instead of "complete".
### Added

- Added feature to create an "open" batch.
- To create an open batch, set the `complete` argument to `True` in the `create_batch` method of the SDK.
- To add jobs to an open batch, use the `add_jobs` method.
- To create an open batch, set the `complete` argument to `True` in the `create_batch` method of the SDK.
- To add jobs to an open batch, use the `add_jobs` method.
- Updated documentation to add examples to create open batches.
- The `wait` argument now waits for all the jobs to be terminated instead of waiting for the batch to be terminated.

Expand Down
5 changes: 2 additions & 3 deletions pasqal_cloud/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import requests
from requests.auth import AuthBase

from pasqal_cloud._version import __version__ as sdk_version
from pasqal_cloud._version import __version__ as sdk_version
from pasqal_cloud.authentication import (
Auth0TokenProvider,
HTTPBearerAuthenticator,
Expand All @@ -36,7 +36,6 @@
from pasqal_cloud.utils.jsend import JobResult, JSendPayload
from pasqal_cloud.utils.retry import retry_http_error


TIMEOUT = 30 # client http requests timeout after 30s


Expand Down Expand Up @@ -127,7 +126,7 @@ def _authenticated_request(
json=payload,
timeout=TIMEOUT,
headers={
"content-type": "application/json",
"content-type": "application/json",
"User-Agent": self.user_agent,
},
auth=self.authenticator,
Expand Down
7 changes: 3 additions & 4 deletions tests/test_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def test_create_batch_with_complete_raises_warning(
):
"""
Test that using complete at batch definition is still accepted but will
trigger a depreceation warning.
trigger a deprecation warning.
"""
with pytest.warns(DeprecationWarning):
batch = self.sdk.create_batch(
Expand All @@ -107,11 +107,10 @@ def test_create_batch_with_complete_raises_warning(
assert batch.id == self.batch_id
assert batch.sequence_builder == self.pulser_sequence
assert not batch.open
assert mock_request.last_request.method == "POST"

@pytest.mark.parametrize("emulator", [None] + [e.value for e in EmulatorType])
def test_create_batch_open_and_complete_raises_error(
self, emulator: Optional[str], mock_request: Generator[Any, Any, None]
):
def test_create_batch_open_and_complete_raises_error(self, emulator: Optional[str]):
"""
Test that setting both complete and open values will result in the proper
error being raised.
Expand Down
12 changes: 3 additions & 9 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ def test_request_pagination_without_pagination_success(
assert len(response) == 1
assert response == [{"id": 1}]


class TestHeaders:
@pytest.fixture(autouse=True)
@patch(
Expand All @@ -467,17 +468,10 @@ def test_user_agent_in_request_headers(
"""
mock_request.reset_mock()
mock_request.register_uri(
"GET",
"http://core-test.com",
status_code=200,
json={
"ok": True
}
"GET", "http://core-test.com", status_code=200, json={"ok": True}
)

_ = self.sdk._client._authenticated_request(
"GET", "http://core-test.com"
)
_ = self.sdk._client._authenticated_request("GET", "http://core-test.com")
assert mock_request.last_request.headers["User-Agent"] == (
f"PasqalCloudSDK/{sdk_version}"
)

0 comments on commit 9b8fec9

Please sign in to comment.