Skip to content

Commit 7145676

Browse files
github-actions[bot]web-flowTakishimaCynocracy
committed
Release version v0.7.3 (#435)
* Merge master into develop branch (#431) * Preparing release vv0.7.2 * Fix missed bug in optimize.py * Fix typo in _optimize.py * Fix linters/formatters warnings * Update missed hooks * Hotfix: fix GitHub action workflows Co-authored-by: GitHub actions <noreply@github.com> Co-authored-by: Nguyen Damien <ngn.damien@gmail.com> * IonQ API: Move to v0.2, and fixup backends path (#433) * Move to v0.2, and fixup backends path The previous path was mistakenly incorrect, could we release this as a patch release of project-Q? Happy to help how I can. * changelog * fix * One more fixup * remove urljoin * fmt * Preparing release v0.7.3 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: GitHub actions <noreply@github.com> Co-authored-by: Nguyen Damien <ngn.damien@gmail.com> Co-authored-by: Jon Donovan <donovan@ionq.co>
1 parent 2b48dd4 commit 7145676

File tree

4 files changed

+30
-21
lines changed

4 files changed

+30
-21
lines changed

.github/workflows/publish_release.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,16 @@ jobs:
5151
run: |
5252
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
5353
VERSION=${BRANCH_NAME#release/}
54+
echo "VERSION = ${VERSION}"
5455
git tag ${VERSION} master
5556
5657
- name: Extract version from branch name (for hotfix branches) (Unix)
5758
if: github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'hotfix/') && runner.os != 'Windows'
5859
run: |
5960
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
6061
VERSION=${BRANCH_NAME#hotfix/}
61-
git tag v${VERSION} master
62+
echo "VERSION = ${VERSION}"
63+
git tag ${VERSION} master
6264
6365
# ------------------------------------------------------------------------
6466

@@ -67,14 +69,16 @@ jobs:
6769
run: |
6870
$BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
6971
$VERSION = $BRANCH_NAME -replace "release/",""
70-
git tag v${VERSION} master
72+
Write-Output "VERSION = ${VERSION}"
73+
git tag ${VERSION} master
7174
7275
- name: Extract version from branch name (for hotfix branches) (Windows)
7376
if: github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'hotfix/') && runner.os == 'Windows'
7477
run: |
7578
$BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
7679
$VERSION = $BRANCH_NAME -replace "hotfix/",""
77-
git tag v${VERSION} master
80+
Write-Output "VERSION = ${VERSION}"
81+
git tag ${VERSION} master
7882
7983
# ========================================================================
8084

@@ -164,7 +168,7 @@ jobs:
164168
if: github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'hotfix/')
165169
run: |
166170
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
167-
VERSION=${BRANCH_NAME#hotfix/}
171+
VERSION=${BRANCH_NAME#hotfix/v}
168172
169173
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
170174

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [v0.7.3] - 2022-04-27
11+
12+
### Fixed
13+
14+
- Fixed IonQ dynamic backends fetch, which relied on an incorrect path.
15+
1016
## [v0.7.2] - 2022-04-11
1117

1218
### Changed
@@ -184,7 +190,9 @@ The ProjectQ v0.5.x release branch is the last one that is guaranteed to work wi
184190

185191
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)
186192

187-
[Unreleased]: https://github.com/ProjectQ-Framework/ProjectQ/compare/v0.7.2...HEAD
193+
[Unreleased]: https://github.com/ProjectQ-Framework/ProjectQ/compare/v0.7.3...HEAD
194+
195+
[v0.7.3]: https://github.com/ProjectQ-Framework/ProjectQ/compare/v0.7.2...v0.7.3
188196

189197
[v0.7.2]: https://github.com/ProjectQ-Framework/ProjectQ/compare/v0.7.1...v0.7.2
190198

projectq/backends/_ionq/_ionq_http_client.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
RequestTimeoutError,
3232
)
3333

34-
_API_URL = 'https://api.ionq.co/v0.1/jobs/'
34+
_API_URL = 'https://api.ionq.co/v0.2/'
35+
_JOB_API_URL = urljoin(_API_URL, 'jobs/')
3536

3637

3738
class IonQ(Session):
@@ -148,7 +149,7 @@ def run(self, info, device):
148149

149150
# _API_URL[:-1] strips the trailing slash.
150151
# TODO: Add comprehensive error parsing for non-200 responses.
151-
req = super().post(_API_URL[:-1], json=argument)
152+
req = super().post(_JOB_API_URL[:-1], json=argument)
152153
req.raise_for_status()
153154

154155
# Process the response.
@@ -211,7 +212,7 @@ def _handle_sigint_during_get_result(*_): # pragma: no cover
211212

212213
try:
213214
for retries in range(num_retries):
214-
req = super().get(urljoin(_API_URL, execution_id))
215+
req = super().get(urljoin(_JOB_API_URL, execution_id))
215216
req.raise_for_status()
216217
r_json = req.json()
217218
status = r_json['status']

projectq/backends/_ionq/_ionq_http_client_test.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import pytest
2020
import requests
21-
from requests.compat import urljoin
2221

2322
from projectq.backends._exceptions import JobSubmissionError, RequestTimeoutError
2423
from projectq.backends._ionq import _ionq_http_client
@@ -30,9 +29,6 @@ def no_requests(monkeypatch):
3029
monkeypatch.delattr('requests.sessions.Session.request')
3130

3231

33-
_api_url = 'https://api.ionq.co/v0.1/jobs/'
34-
35-
3632
def test_authenticate():
3733
ionq_session = _ionq_http_client.IonQ()
3834
ionq_session.authenticate('NotNone')
@@ -55,7 +51,7 @@ def user_password_input(prompt):
5551

5652
def test_is_online(monkeypatch):
5753
def mock_get(_self, path, *args, **kwargs):
58-
assert urljoin(_api_url, 'backends') == path
54+
assert 'https://api.ionq.co/v0.2/backends' == path
5955
mock_response = mock.MagicMock()
6056
mock_response.json = mock.MagicMock(
6157
return_value=[
@@ -91,7 +87,7 @@ def mock_get(_self, path, *args, **kwargs):
9187

9288
def test_show_devices(monkeypatch):
9389
def mock_get(_self, path, *args, **kwargs):
94-
assert urljoin(_api_url, 'backends') == path
90+
assert 'https://api.ionq.co/v0.2/backends' == path
9591
mock_response = mock.MagicMock()
9692
mock_response.json = mock.MagicMock(
9793
return_value=[
@@ -187,7 +183,7 @@ def _dummy_update(_self):
187183
}
188184

189185
def mock_post(_self, path, *args, **kwargs):
190-
assert path == _api_url[:-1]
186+
assert path == 'https://api.ionq.co/v0.2/jobs'
191187
assert 'json' in kwargs
192188
assert expected_request == kwargs['json']
193189
mock_response = mock.MagicMock()
@@ -201,7 +197,7 @@ def mock_post(_self, path, *args, **kwargs):
201197
return mock_response
202198

203199
def mock_get(_self, path, *args, **kwargs):
204-
assert urljoin(_api_url, 'new-job-id') == path
200+
assert path == 'https://api.ionq.co/v0.2/jobs/new-job-id'
205201
mock_response = mock.MagicMock()
206202
mock_response.json = mock.MagicMock(
207203
return_value={
@@ -433,7 +429,7 @@ def _dummy_update(_self):
433429
)
434430

435431
def mock_post(_self, path, **kwargs):
436-
assert _api_url[:-1] == path
432+
assert path == 'https://api.ionq.co/v0.2/jobs'
437433
mock_response = mock.MagicMock()
438434
mock_response.json = mock.MagicMock(return_value=err_data)
439435
return mock_response
@@ -472,7 +468,7 @@ def _dummy_update(_self):
472468
)
473469

474470
def mock_post(_self, path, *args, **kwargs):
475-
assert path == _api_url[:-1]
471+
assert path == 'https://api.ionq.co/v0.2/jobs'
476472
mock_response = mock.MagicMock()
477473
mock_response.json = mock.MagicMock(
478474
return_value={
@@ -483,7 +479,7 @@ def mock_post(_self, path, *args, **kwargs):
483479
return mock_response
484480

485481
def mock_get(_self, path, *args, **kwargs):
486-
assert urljoin(_api_url, 'new-job-id') == path
482+
assert path == 'https://api.ionq.co/v0.2/jobs/new-job-id'
487483
mock_response = mock.MagicMock()
488484
mock_response.json = mock.MagicMock(
489485
return_value={
@@ -533,7 +529,7 @@ def _dummy_update(_self):
533529
request_num = [0]
534530

535531
def mock_get(_self, path, *args, **kwargs):
536-
assert urljoin(_api_url, 'old-job-id') == path
532+
assert path == 'https://api.ionq.co/v0.2/jobs/old-job-id'
537533
json_response = {
538534
'id': 'old-job-id',
539535
'status': 'running',
@@ -591,7 +587,7 @@ def _dummy_update(_self):
591587
request_num = [0]
592588

593589
def mock_get(_self, path, *args, **kwargs):
594-
assert urljoin(_api_url, 'old-job-id') == path
590+
assert path == 'https://api.ionq.co/v0.2/jobs/old-job-id'
595591
json_response = {
596592
'id': 'old-job-id',
597593
'status': 'running',

0 commit comments

Comments
 (0)