Skip to content

Commit

Permalink
Merge branch 'main' into update_fake_backends/1
Browse files Browse the repository at this point in the history
  • Loading branch information
1ucian0 authored Jan 18, 2024
2 parents 445c886 + bde88f8 commit c1ab5e5
Show file tree
Hide file tree
Showing 88 changed files with 1,558 additions and 189 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/q-ctrl-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# This code is part of Qiskit.
#
# (C) Copyright IBM 2023.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

name: Q-CTRL Tests
on:
push:
tags:
- "*"
workflow_dispatch:
jobs:
integration-tests:
name: Run integration tests - ${{ matrix.environment }}
runs-on: ${{ matrix.os }}
strategy:
# avoid cancellation of in-progress jobs if any matrix job fails
fail-fast: false
matrix:
python-version: [ 3.9 ]
os: [ "ubuntu-latest" ]
environment: [ "ibm-cloud-staging" ]
environment: ${{ matrix.environment }}
env:
QISKIT_IBM_TOKEN: ${{ secrets.QISKIT_IBM_TOKEN_QCTRL }}
QISKIT_IBM_URL: ${{ secrets.QISKIT_IBM_URL }}
QISKIT_IBM_INSTANCE: ${{ secrets.QISKIT_IBM_INSTANCE_QCTRL }}
CHANNEL_STRATEGY: q-ctrl
LOG_LEVEL: DEBUG
STREAM_LOG: True
QISKIT_IN_PARALLEL: True
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -c constraints.txt -r requirements-dev.txt
- name: Run q-ctrl tests
run: python -m unittest test/qctrl/test_qctrl.py
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Contributing
First read the overall project contributing guidelines. These are all
included in the qiskit documentation:

https://qiskit.org/documentation/contributing_to_qiskit.html
https://github.com/Qiskit/qiskit/blob/main/CONTRIBUTING.md


## Contributing to qiskit-ibm-runtime
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include LICENSE.txt README.md
include qiskit_ibm_runtime/VERSION.txt
recursive-include qiskit_ibm_runtime/fake_provider/backends *.json
recursive-include test *.py
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ All quantum applications and algorithms level are fundamentally built using thre
2. Define the observable or the classical register to be measured.
4. Execute the quantum circuits by using a primitive (Estimator or Sampler).

**Primitives** are base-level functions that serve as building blocks for many quantum algorithms and applications. The [primitive interfaces](https://qiskit.org/documentation/apidoc/primitives.html) are defined in Qiskit.
**Primitives** are base-level functions that serve as building blocks for many quantum algorithms and applications. The [primitive interfaces](https://docs.quantum.ibm.com/api/qiskit/primitives) are defined in Qiskit.

The IBM Runtime service offers these primitives with additional features, such as built-in error suppression and mitigation.

Expand Down Expand Up @@ -319,7 +319,7 @@ By participating, you are expected to uphold to this code.

We use [GitHub issues] for tracking requests and bugs. Please use our [slack]
for discussion and simple questions. To join our Slack community use the
invite link at [Qiskit.org]. For questions that are more suited for a forum we
invite link at [ibm.com/quantum/qiskit]. For questions that are more suited for a forum we
use the `Qiskit` tag in [Stack Exchange].

## License
Expand All @@ -334,7 +334,7 @@ use the `Qiskit` tag in [Stack Exchange].
[code of conduct]: https://github.com/Qiskit/qiskit-ibm-runtime/blob/main/CODE_OF_CONDUCT.md
[GitHub issues]: https://github.com/Qiskit/qiskit-ibm-runtime/issues
[slack]: https://qiskit.slack.com
[Qiskit.org]: https://qiskit.org
[ibm.com/quantum/qiskit]: https://www.ibm.com/quantum/qiskit
[Stack Exchange]: https://quantumcomputing.stackexchange.com/questions/tagged/qiskit
[many people]: https://github.com/Qiskit/qiskit-ibm-runtime/graphs/contributors
[BibTeX file]: https://github.com/Qiskit/qiskit/blob/master/Qiskit.bib
Expand Down
6 changes: 4 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,21 @@
# The short X.Y version
version = ''
# The full version, including alpha/beta/rc tags
release = '0.17.0'
release = '0.17.1'

# -- General configuration ---------------------------------------------------

extensions = [
'sphinx.ext.napoleon',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.mathjax',
# This is used by qiskit/documentation to generate links to github.com.
"sphinx.ext.viewcode",
'jupyter_sphinx',
'sphinx_autodoc_typehints',
'reno.sphinxext',
'nbsphinx',
'sphinxcontrib.katex',
]
templates_path = ['_templates']

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/grover_with_sampler.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
"outputs": [],
"source": [
"optimal_num_iterations = math.floor(\n",
" math.pi / 4 * math.sqrt(2**grover_op.num_qubits / len(marked_states))\n",
" math.pi / (4 * math.asin(math.sqrt(len(marked_states) / 2**grover_op.num_qubits)))\n",
")"
]
},
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/how-to-getting-started-with-sampler.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
},
"source": [
"<!-- vale off -->\n",
"The next step is to create an instance of an `Sampler` class, which can be any of the subclasses that comply with the base specification. For simplicity, we will use Qiskit Terra's `qiskit.primitives.Sampler` class, based on the [Statevector construct](https://qiskit.org/documentation/stubs/qiskit.quantum_info.Statevector.html?highlight=statevector#qiskit.quantum_info.Statevector) (that is, algebraic simulation).\n",
"The next step is to create an instance of an `Sampler` class, which can be any of the subclasses that comply with the base specification. For simplicity, we will use Qiskit Terra's `qiskit.primitives.Sampler` class, based on the [Statevector construct](https://docs.quantum.ibm.com/api/qiskit/qiskit.quantum_info.Statevector) (that is, algebraic simulation).\n",
"<!-- vale on -->"
]
},
Expand Down
2 changes: 1 addition & 1 deletion qiskit_ibm_runtime/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.17.0
0.17.1
4 changes: 2 additions & 2 deletions qiskit_ibm_runtime/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@
Interim and final results
-------------------------
Some runtime programs provide interim results that inform you about program
progress. You can choose to stream the interim results and final result when you run the
Some runtime primitives provide interim results that inform you about the
progress of your job. You can choose to stream the interim results and final result when you run the
program by passing in the ``callback`` parameter, or at a later time using
the :meth:`RuntimeJob.stream_results` method. For example::
Expand Down
41 changes: 1 addition & 40 deletions qiskit_ibm_runtime/accounts/management.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,17 @@
"""Account management related classes and functions."""

import os
import ast
from typing import Optional, Dict

from qiskit_ibm_provider.proxies import ProxyConfiguration

from qiskit_ibm_runtime.utils.deprecation import issue_deprecation_msg
from .exceptions import AccountNotFoundError
from .account import Account, ChannelType
from .storage import save_config, read_config, delete_config, read_qiskitrc
from .storage import save_config, read_config, delete_config

_DEFAULT_ACCOUNT_CONFIG_JSON_FILE = os.path.join(
os.path.expanduser("~"), ".qiskit", "qiskit-ibm.json"
)
_QISKITRC_CONFIG_FILE = os.path.join(os.path.expanduser("~"), ".qiskit", "qiskitrc")
_DEFAULT_ACCOUNT_NAME = "default"
_DEFAULT_ACCOUNT_NAME_IBM_QUANTUM = "default-ibm-quantum"
_DEFAULT_ACCOUNT_NAME_IBM_CLOUD = "default-ibm-cloud"
Expand Down Expand Up @@ -196,15 +193,6 @@ def get(
if account_name in all_config:
return Account.from_saved_format(all_config[account_name])

if os.path.isfile(_QISKITRC_CONFIG_FILE):
issue_deprecation_msg(
msg="Use of the ~/.qiskit/qiskitrc.json file is deprecated.",
version="0.15.0",
remedy="Please use the ~/.qiskit/qiskit-ibm.json file instead.",
period="1 month",
)
return cls._from_qiskitrc_file()

raise AccountNotFoundError("Unable to find account.")

@classmethod
Expand Down Expand Up @@ -272,30 +260,3 @@ def _get_default_account_name(cls, channel: ChannelType) -> str:
if channel == "ibm_quantum"
else _DEFAULT_ACCOUNT_NAME_IBM_CLOUD
)

@classmethod
def _from_qiskitrc_file(cls) -> Optional[Account]:
"""Read account from qiskitrc file."""
qiskitrc_data = read_qiskitrc(_QISKITRC_CONFIG_FILE)
proxies = (
ProxyConfiguration(ast.literal_eval(qiskitrc_data["proxies"]))
if "proxies" in qiskitrc_data
else None
)
save_config(
filename=_DEFAULT_ACCOUNT_CONFIG_JSON_FILE,
name=_DEFAULT_ACCOUNT_NAME_IBM_QUANTUM,
overwrite=False,
config=Account.create_account(
token=qiskitrc_data.get("token", None),
url=qiskitrc_data.get("url", None),
instance=qiskitrc_data.get("default_provider", None),
verify=bool(qiskitrc_data.get("verify", None)),
proxies=proxies,
channel="ibm_quantum",
)
.validate()
.to_saved_format(),
)
default_config = read_config(filename=_DEFAULT_ACCOUNT_CONFIG_JSON_FILE)
return Account.from_saved_format(default_config[_DEFAULT_ACCOUNT_NAME_IBM_QUANTUM])
11 changes: 0 additions & 11 deletions qiskit_ibm_runtime/accounts/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import logging
import os
from typing import Optional, Dict
from configparser import ConfigParser
from .exceptions import AccountAlreadyExistsError

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -58,16 +57,6 @@ def save_config(
json.dump(data, json_out, sort_keys=True, indent=4)


def read_qiskitrc(qiskitrc_config_file: str) -> Dict[str, str]:
"""Read credentials from a qiskitrc config and return as a dictionary."""
config_parser = ConfigParser()
config_parser.read(qiskitrc_config_file)
account_data = {}
for name in config_parser.sections():
account_data = dict(config_parser.items(name))
return account_data


def read_config(
filename: str,
name: Optional[str] = None,
Expand Down
2 changes: 1 addition & 1 deletion qiskit_ibm_runtime/api/clients/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def program_run(
**hgp_dict,
)

def job_get(self, job_id: str, exclude_params: bool = None) -> Dict:
def job_get(self, job_id: str, exclude_params: bool = True) -> Dict:
"""Get job data.
Args:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""

import os
from qiskit.providers.fake_provider import fake_qasm_backend, fake_backend
from qiskit_ibm_runtime.fake_provider import fake_qasm_backend, fake_backend


class FakeAlmadenV2(fake_backend.FakeBackendV2):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""

import os
from qiskit.providers.fake_provider import fake_pulse_backend, fake_backend
from qiskit_ibm_runtime.fake_provider import fake_pulse_backend, fake_backend


class FakeArmonkV2(fake_backend.FakeBackendV2):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""

import os
from qiskit.providers.fake_provider import fake_pulse_backend, fake_backend
from qiskit_ibm_runtime.fake_provider import fake_pulse_backend, fake_backend


class FakeAthensV2(fake_backend.FakeBackendV2):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"""

import os
from qiskit.providers.fake_provider import fake_backend
from qiskit_ibm_runtime.fake_provider import fake_backend


class FakeAuckland(fake_backend.FakeBackendV2):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""

import os
from qiskit.providers.fake_provider import fake_pulse_backend, fake_backend
from qiskit_ibm_runtime.fake_provider import fake_pulse_backend, fake_backend


class FakeBelemV2(fake_backend.FakeBackendV2):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""

import os
from qiskit.providers.fake_provider import fake_pulse_backend, fake_backend
from qiskit_ibm_runtime.fake_provider import fake_pulse_backend, fake_backend


class FakeBoeblingenV2(fake_backend.FakeBackendV2):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""

import os
from qiskit.providers.fake_provider import fake_pulse_backend, fake_backend
from qiskit_ibm_runtime.fake_provider import fake_pulse_backend, fake_backend


class FakeBogotaV2(fake_backend.FakeBackendV2):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""

import os
from qiskit.providers.fake_provider import fake_pulse_backend, fake_backend
from qiskit_ibm_runtime.fake_provider import fake_pulse_backend, fake_backend


class FakeBrooklynV2(fake_backend.FakeBackendV2):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""

import os
from qiskit.providers.fake_provider import fake_qasm_backend, fake_backend
from qiskit_ibm_runtime.fake_provider import fake_qasm_backend, fake_backend


class FakeBurlingtonV2(fake_backend.FakeBackendV2):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""

import os
from qiskit.providers.fake_provider import fake_pulse_backend, fake_backend
from qiskit_ibm_runtime.fake_provider import fake_pulse_backend, fake_backend


class FakeCairoV2(fake_backend.FakeBackendV2):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""

import os
from qiskit.providers.fake_provider import fake_qasm_backend, fake_backend
from qiskit_ibm_runtime.fake_provider import fake_qasm_backend, fake_backend


class FakeCambridgeV2(fake_backend.FakeBackendV2):
Expand Down Expand Up @@ -68,5 +68,5 @@ class FakeCambridgeAlternativeBasis(FakeCambridge):
props_filename = "props_cambridge_alt.json" # type: ignore

def __init__(self) -> None:
super().__init__()
super().__init__() # type: ignore
self._configuration.basis_gates = ["u", "sx", "p", "cx", "id"]
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""

import os
from qiskit.providers.fake_provider import fake_pulse_backend, fake_backend
from qiskit_ibm_runtime.fake_provider import fake_pulse_backend, fake_backend


class FakeCasablancaV2(fake_backend.FakeBackendV2):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""

import os
from qiskit.providers.fake_provider import fake_qasm_backend, fake_backend
from qiskit_ibm_runtime.fake_provider import fake_qasm_backend, fake_backend


class FakeEssexV2(fake_backend.FakeBackendV2):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"""

import os
from qiskit.providers.fake_provider import fake_backend
from qiskit_ibm_runtime.fake_provider import fake_backend


class FakeGeneva(fake_backend.FakeBackendV2):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import os

from qiskit.providers.fake_provider import fake_pulse_backend, fake_backend
from qiskit_ibm_runtime.fake_provider import fake_pulse_backend, fake_backend


class FakeGuadalupeV2(fake_backend.FakeBackendV2):
Expand Down
Loading

0 comments on commit c1ab5e5

Please sign in to comment.