Skip to content

Commit

Permalink
Release version v0.7.3 (#435)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
4 people committed Apr 27, 2022
1 parent 2b48dd4 commit 7145676
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 21 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,16 @@ 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)
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#hotfix/}
git tag v${VERSION} master
echo "VERSION = ${VERSION}"
git tag ${VERSION} master
# ------------------------------------------------------------------------

Expand All @@ -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
# ========================================================================

Expand Down Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
7 changes: 4 additions & 3 deletions projectq/backends/_ionq/_ionq_http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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']
Expand Down
22 changes: 9 additions & 13 deletions projectq/backends/_ionq/_ionq_http_client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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')
Expand All @@ -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=[
Expand Down Expand Up @@ -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=[
Expand Down Expand Up @@ -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()
Expand All @@ -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={
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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={
Expand All @@ -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={
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 7145676

Please sign in to comment.