diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml index 9865fee58..0849ee1fa 100644 --- a/.github/workflows/publish_release.yml +++ b/.github/workflows/publish_release.yml @@ -51,6 +51,7 @@ jobs: run: | BRANCH_NAME="${{ github.event.pull_request.head.ref }}" VERSION=${BRANCH_NAME#release/} + echo "VERSION = ${VERSION}" git tag ${VERSION} master - name: Extract version from branch name (for hotfix branches) (Unix) @@ -58,7 +59,8 @@ jobs: run: | BRANCH_NAME="${{ github.event.pull_request.head.ref }}" VERSION=${BRANCH_NAME#hotfix/} - git tag v${VERSION} master + echo "VERSION = ${VERSION}" + git tag ${VERSION} master # ------------------------------------------------------------------------ @@ -67,14 +69,16 @@ jobs: run: | $BRANCH_NAME="${{ github.event.pull_request.head.ref }}" $VERSION = $BRANCH_NAME -replace "release/","" - git tag v${VERSION} master + Write-Output "VERSION = ${VERSION}" + git tag ${VERSION} master - name: Extract version from branch name (for hotfix branches) (Windows) if: github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'hotfix/') && runner.os == 'Windows' run: | $BRANCH_NAME="${{ github.event.pull_request.head.ref }}" $VERSION = $BRANCH_NAME -replace "hotfix/","" - git tag v${VERSION} master + Write-Output "VERSION = ${VERSION}" + git tag ${VERSION} master # ======================================================================== @@ -164,7 +168,7 @@ jobs: if: github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'hotfix/') run: | BRANCH_NAME="${{ github.event.pull_request.head.ref }}" - VERSION=${BRANCH_NAME#hotfix/} + VERSION=${BRANCH_NAME#hotfix/v} echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV diff --git a/CHANGELOG.md b/CHANGELOG.md index 919917f69..31e3d2685 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [v0.7.3] - 2022-04-27 + +### Fixed + +- Fixed IonQ dynamic backends fetch, which relied on an incorrect path. + ## [v0.7.2] - 2022-04-11 ### Changed @@ -184,7 +190,9 @@ The ProjectQ v0.5.x release branch is the last one that is guaranteed to work wi Future releases might introduce changes that will require Python 3.5 (Python 3.4 and earlier have already been declared deprecated at the time of this writing) -[Unreleased]: https://github.com/ProjectQ-Framework/ProjectQ/compare/v0.7.2...HEAD +[Unreleased]: https://github.com/ProjectQ-Framework/ProjectQ/compare/v0.7.3...HEAD + +[v0.7.3]: https://github.com/ProjectQ-Framework/ProjectQ/compare/v0.7.2...v0.7.3 [v0.7.2]: https://github.com/ProjectQ-Framework/ProjectQ/compare/v0.7.1...v0.7.2 diff --git a/projectq/backends/_ionq/_ionq_http_client.py b/projectq/backends/_ionq/_ionq_http_client.py index 1eb5e573c..4a92ecc57 100644 --- a/projectq/backends/_ionq/_ionq_http_client.py +++ b/projectq/backends/_ionq/_ionq_http_client.py @@ -31,7 +31,8 @@ RequestTimeoutError, ) -_API_URL = 'https://api.ionq.co/v0.1/jobs/' +_API_URL = 'https://api.ionq.co/v0.2/' +_JOB_API_URL = urljoin(_API_URL, 'jobs/') class IonQ(Session): @@ -148,7 +149,7 @@ def run(self, info, device): # _API_URL[:-1] strips the trailing slash. # TODO: Add comprehensive error parsing for non-200 responses. - req = super().post(_API_URL[:-1], json=argument) + req = super().post(_JOB_API_URL[:-1], json=argument) req.raise_for_status() # Process the response. @@ -211,7 +212,7 @@ def _handle_sigint_during_get_result(*_): # pragma: no cover try: for retries in range(num_retries): - req = super().get(urljoin(_API_URL, execution_id)) + req = super().get(urljoin(_JOB_API_URL, execution_id)) req.raise_for_status() r_json = req.json() status = r_json['status'] diff --git a/projectq/backends/_ionq/_ionq_http_client_test.py b/projectq/backends/_ionq/_ionq_http_client_test.py index d24340d27..d92fb88f4 100644 --- a/projectq/backends/_ionq/_ionq_http_client_test.py +++ b/projectq/backends/_ionq/_ionq_http_client_test.py @@ -18,7 +18,6 @@ import pytest import requests -from requests.compat import urljoin from projectq.backends._exceptions import JobSubmissionError, RequestTimeoutError from projectq.backends._ionq import _ionq_http_client @@ -30,9 +29,6 @@ def no_requests(monkeypatch): monkeypatch.delattr('requests.sessions.Session.request') -_api_url = 'https://api.ionq.co/v0.1/jobs/' - - def test_authenticate(): ionq_session = _ionq_http_client.IonQ() ionq_session.authenticate('NotNone') @@ -55,7 +51,7 @@ def user_password_input(prompt): def test_is_online(monkeypatch): def mock_get(_self, path, *args, **kwargs): - assert urljoin(_api_url, 'backends') == path + assert 'https://api.ionq.co/v0.2/backends' == path mock_response = mock.MagicMock() mock_response.json = mock.MagicMock( return_value=[ @@ -91,7 +87,7 @@ def mock_get(_self, path, *args, **kwargs): def test_show_devices(monkeypatch): def mock_get(_self, path, *args, **kwargs): - assert urljoin(_api_url, 'backends') == path + assert 'https://api.ionq.co/v0.2/backends' == path mock_response = mock.MagicMock() mock_response.json = mock.MagicMock( return_value=[ @@ -187,7 +183,7 @@ def _dummy_update(_self): } def mock_post(_self, path, *args, **kwargs): - assert path == _api_url[:-1] + assert path == 'https://api.ionq.co/v0.2/jobs' assert 'json' in kwargs assert expected_request == kwargs['json'] mock_response = mock.MagicMock() @@ -201,7 +197,7 @@ def mock_post(_self, path, *args, **kwargs): return mock_response def mock_get(_self, path, *args, **kwargs): - assert urljoin(_api_url, 'new-job-id') == path + assert path == 'https://api.ionq.co/v0.2/jobs/new-job-id' mock_response = mock.MagicMock() mock_response.json = mock.MagicMock( return_value={ @@ -433,7 +429,7 @@ def _dummy_update(_self): ) def mock_post(_self, path, **kwargs): - assert _api_url[:-1] == path + assert path == 'https://api.ionq.co/v0.2/jobs' mock_response = mock.MagicMock() mock_response.json = mock.MagicMock(return_value=err_data) return mock_response @@ -472,7 +468,7 @@ def _dummy_update(_self): ) def mock_post(_self, path, *args, **kwargs): - assert path == _api_url[:-1] + assert path == 'https://api.ionq.co/v0.2/jobs' mock_response = mock.MagicMock() mock_response.json = mock.MagicMock( return_value={ @@ -483,7 +479,7 @@ def mock_post(_self, path, *args, **kwargs): return mock_response def mock_get(_self, path, *args, **kwargs): - assert urljoin(_api_url, 'new-job-id') == path + assert path == 'https://api.ionq.co/v0.2/jobs/new-job-id' mock_response = mock.MagicMock() mock_response.json = mock.MagicMock( return_value={ @@ -533,7 +529,7 @@ def _dummy_update(_self): request_num = [0] def mock_get(_self, path, *args, **kwargs): - assert urljoin(_api_url, 'old-job-id') == path + assert path == 'https://api.ionq.co/v0.2/jobs/old-job-id' json_response = { 'id': 'old-job-id', 'status': 'running', @@ -591,7 +587,7 @@ def _dummy_update(_self): request_num = [0] def mock_get(_self, path, *args, **kwargs): - assert urljoin(_api_url, 'old-job-id') == path + assert path == 'https://api.ionq.co/v0.2/jobs/old-job-id' json_response = { 'id': 'old-job-id', 'status': 'running',