Skip to content

Commit

Permalink
Merge 0.45.1 into 0.46 (Qiskit#11341)
Browse files Browse the repository at this point in the history
<!--
⚠️ If you do not respect this template, your pull request will be
closed.
⚠️ Your pull request title should be short detailed and understandable
for all.
⚠️ Also, please add a release note file using reno if the change needs
to be
  documented in the release notes.
⚠️ If your pull request fixes an open issue, please link to the issue.

- [ ] I have added the tests to cover my changes.
- [ ] I have updated the documentation accordingly.
- [ ] I have read the CONTRIBUTING document.
-->

### Summary

This is a merge of the changes that were backported to 0.45.1 into the
0.46 branch, at the time of the 0.45.1 tag. It's made as a merge commit,
but we can likely choose to merge it as a squash without real problems.

### Details and comments
  • Loading branch information
mtreinish authored Nov 30, 2023
2 parents 3784358 + dbda5f2 commit 3b9225b
Show file tree
Hide file tree
Showing 112 changed files with 671 additions and 366 deletions.
3 changes: 3 additions & 0 deletions .azure/lint-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ jobs:
-c constraints.txt \
-r requirements.txt \
-r requirements-dev.txt \
./qiskit_pkg \
-e .
# Build and install both qiskit and qiskit-terra so that any optionals
# depending on `qiskit` will resolve correctly.
displayName: 'Install dependencies'
env:
SETUPTOOLS_ENABLE_FEATURES: "legacy-editable"
Expand Down
15 changes: 10 additions & 5 deletions .azure/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,17 @@ jobs:
# Use stable Rust, rather than MSRV, to spot-check that stable builds properly.
rustup override set stable
source test-job/bin/activate
python -m pip install -U pip setuptools wheel
# Install setuptools-rust for building sdist
python -m pip install -U -c constraints.txt setuptools-rust
python setup.py sdist
python -m pip install -U pip
python -m pip install -U build
python -m build --sdist .
python -m build --sdist qiskit_pkg
python -m pip install -U \
-c constraints.txt \
-r requirements.txt \
-r requirements-dev.txt \
dist/qiskit-terra*.tar.gz
dist/qiskit*.tar.gz
# Build and install both qiskit and qiskit-terra so that any optionals
# depending on `qiskit` will resolve correctly.
displayName: "Install Terra from sdist"
- ${{ if eq(parameters.installFromSdist, false) }}:
Expand All @@ -90,7 +92,10 @@ jobs:
-c constraints.txt \
-r requirements.txt \
-r requirements-dev.txt \
./qiskit_pkg \
-e .
# Build and install both qiskit and qiskit-terra so that any optionals
# depending on `qiskit` will resolve correctly.
displayName: "Install Terra directly"
env:
SETUPTOOLS_ENABLE_FEATURES: "legacy-editable"
Expand Down
3 changes: 3 additions & 0 deletions .azure/test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ jobs:
-c constraints.txt \
-r requirements.txt \
-r requirements-dev.txt \
./qiskit_pkg \
-e .
# Build and install both qiskit and qiskit-terra so that any optionals
# depending on `qiskit` will resolve correctly.
pip check
displayName: 'Install dependencies'
env:
Expand Down
3 changes: 3 additions & 0 deletions .azure/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ jobs:
-c constraints.txt \
-r requirements.txt \
-r requirements-dev.txt \
./qiskit_pkg \
-e .
# Build and install both qiskit and qiskit-terra so that any optionals
# depending on `qiskit` will resolve correctly.
pip check
displayName: 'Install dependencies'
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
run: python -m pip install -c constraints.txt --upgrade pip setuptools wheel

- name: Build and install qiskit-terra
run: python -m pip install -c constraints.txt -e .
run: python -m pip install -c constraints.txt -e . ./qiskit_pkg
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-Cinstrument-coverage"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/slow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
python -m pip install -U pip setuptools wheel
python -m pip install -U -r requirements.txt -c constraints.txt
python -m pip install -U -r requirements-dev.txt -c constraints.txt
python -m pip install -c constraints.txt -e .
python -m pip install -c constraints.txt -e . ./qiskit_pkg
python -m pip install "qiskit-aer" "z3-solver" "cplex" -c constraints.txt
env:
SETUPTOOLS_ENABLE_FEATURES: "legacy-editable"
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ jobs:
with:
python-version: '3.10'
- uses: dtolnay/rust-toolchain@stable
if: runner.os != 'macOS'
- uses: dtolnay/[email protected]
if: runner.os == 'macOS'
- name: Build wheels
uses: pypa/cibuildwheel@v2.13.0
uses: pypa/cibuildwheel@v2.16.2
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
Expand All @@ -42,7 +45,7 @@ jobs:
python-version: '3.10'
- uses: dtolnay/rust-toolchain@stable
- name: Build wheels
uses: pypa/cibuildwheel@v2.13.0
uses: pypa/cibuildwheel@v2.16.2
env:
CIBW_BEFORE_ALL: rustup target add aarch64-apple-darwin
CIBW_ARCHS_MACOS: arm64 universal2
Expand Down Expand Up @@ -91,7 +94,7 @@ jobs:
with:
platforms: all
- name: Build wheels
uses: pypa/cibuildwheel@v2.13.0
uses: pypa/cibuildwheel@v2.16.2
env:
CIBW_ARCHS_LINUX: s390x
CIBW_TEST_SKIP: "cp*"
Expand Down Expand Up @@ -124,7 +127,7 @@ jobs:
with:
platforms: all
- name: Build wheels
uses: pypa/cibuildwheel@v2.13.0
uses: pypa/cibuildwheel@v2.16.2
env:
CIBW_ARCHS_LINUX: ppc64le
CIBW_TEST_SKIP: "cp*"
Expand Down Expand Up @@ -157,7 +160,7 @@ jobs:
with:
platforms: all
- name: Build wheels
uses: pypa/cibuildwheel@v2.13.0
uses: pypa/cibuildwheel@v2.16.2
env:
CIBW_ARCHS_LINUX: aarch64
- uses: actions/upload-artifact@v3
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
members = ["crates/*"]

[workspace.package]
version = "0.45.0"
version = "0.45.1"
edition = "2021"
rust-version = "1.64" # Keep in sync with README.md and rust-toolchain.toml.
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ qc_example.cx(0,1) # 0th-qubit-Controlled-NOT gate on 1st qubit
qc_example.cx(0,2) # 0th-qubit-Controlled-NOT gate on 2nd qubit
```

This simple example makes an entangled state known as a [GHZ state](https://en.wikipedia.org/wiki/Greenberger%E2%80%93Horne%E2%80%93Zeilinger_state) $(|000\rangle + |111\rangle)/\sqrt{2}$. It uses the standard quantum gates: Hadamard gate (`h`), Phase gate (`p`), and CNOT gate (`cx`).
This simple example makes an entangled state known as a [GHZ state](https://en.wikipedia.org/wiki/Greenberger%E2%80%93Horne%E2%80%93Zeilinger_state) $(|000\rangle + i|111\rangle)/\sqrt{2}$. It uses the standard quantum gates: Hadamard gate (`h`), Phase gate (`p`), and CNOT gate (`cx`).

Once you've made your first quantum circuit, choose which primitive function you will use. Starting with `sampler`,
we use `measure_all(inplace=False)` to get a copy of the circuit in which all the qubits are measured:
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ parameters:
- name: "supportedPythonVersions"
displayName: "All supported versions of Python"
type: object
default: ["3.8", "3.9", "3.10", "3.11"]
default: ["3.8", "3.9", "3.10", "3.11", "3.12"]

- name: "minimumPythonVersion"
displayName: "Minimum supported version of Python"
Expand All @@ -41,7 +41,7 @@ parameters:
- name: "maximumPythonVersion"
displayName: "Maximum supported version of Python"
type: string
default: "3.11"
default: "3.12"

# These two versions of Python can be chosen somewhat arbitrarily, but we get
# slightly better coverage per PR if they're neither the maximum nor minimum
Expand Down
7 changes: 1 addition & 6 deletions constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@
# 4.0+. The pin can be removed after nbformat is updated.
jsonschema==3.2.0

# Numpy 1.25 deprecated some behaviours that we used, and caused the isometry
# tests to flake. See https://github.com/Qiskit/qiskit-terra/issues/10305,
# remove pin when resolving that.
numpy<1.25

# Scipy 1.11 seems to have caused an instability in the Weyl coordinates
# eigensystem code for one of the test cases. See
# https://github.com/Qiskit/qiskit-terra/issues/10345 for current details.
scipy<1.11
scipy<1.11; python_version<'3.12'

# Aer 0.13 causes several randomised tests to begin failing, and some
# `QuantumInstance` use of noise models to raise exceptions. These need fixes
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# The short X.Y version
version = "0.45"
# The full version, including alpha/beta/rc tags
release = "0.45.0"
release = "0.45.1"

language = "en"

Expand Down
2 changes: 1 addition & 1 deletion docs/deprecation_policy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ It is important to warn the user when your breaking changes are coming.
for the function so that it shows up in docs.

If you are not using those decorators, you should directly add a `Sphinx deprecated directive
<https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-deprecated>`__ ::
<https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-deprecated>`__:

.. code-block:: python
Expand Down
6 changes: 3 additions & 3 deletions docs/maintainers_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Stable Branch Policy
====================

The stable branch is intended to be a safe source of fixes for high-impact
bugs and security issues that have been fixed on master since a
bugs and security issues that have been fixed on ``main`` since a
release. When reviewing a stable branch PR, we must balance the risk
of any given patch with the value that it will provide to users of the
stable branch. Only a limited class of changes are appropriate for
Expand All @@ -29,8 +29,8 @@ change:
also refactors a lot of code, it's probably worth thinking about
what a less risky fix might look like.
- Whether the fix is already on ``main``: a change must be a backport of
a change already merged onto master, unless the change simply does
not make sense on master.
a change already merged onto ``main``, unless the change simply does
not make sense on ``main``.


Backporting
Expand Down
7 changes: 6 additions & 1 deletion docs/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ This page contains the release notes for Qiskit, starting from the point at whic
"meta-package" structure of Qiskit, see :ref:`legacy-release-notes`.

.. release-notes::
:earliest-version: 0.25.0rc1
:earliest-version: 0.45.0
:branch: stable/0.45

.. release-notes::
:earliest-version: 0.25.0
:branch: stable/0.25
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ repair-wheel-command = "auditwheel repair -w {dest_dir} {wheel} && pipx run abi3

[tool.cibuildwheel.macos]
repair-wheel-command = "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} && pipx run abi3audit --strict --report {wheel}"
environment = 'RUSTUP_TOOLCHAIN="1.73"'

[tool.cibuildwheel.windows]
repair-wheel-command = "cp {wheel} {dest_dir}/. && pipx run abi3audit --strict --report {wheel}"
Expand Down
2 changes: 1 addition & 1 deletion qiskit/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.45.0
0.45.1
7 changes: 3 additions & 4 deletions qiskit/circuit/instruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,12 +618,11 @@ def repeat(self, n):
@property
def condition_bits(self) -> List[Clbit]:
"""Get Clbits in condition."""
from qiskit.circuit.controlflow import condition_resources # pylint: disable=cyclic-import

if self.condition is None:
return []
if isinstance(self.condition[0], Clbit):
return [self.condition[0]]
else: # ClassicalRegister
return list(self.condition[0])
return list(condition_resources(self.condition).clbits)

@property
def name(self):
Expand Down
3 changes: 2 additions & 1 deletion qiskit/circuit/library/overlap.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from qiskit.circuit import QuantumCircuit, Gate
from qiskit.circuit.parametervector import ParameterVector
from qiskit.circuit.exceptions import CircuitError
from qiskit.circuit import Barrier


class UnitaryOverlap(QuantumCircuit):
Expand Down Expand Up @@ -101,7 +102,7 @@ def _check_unitary(circuit):
"""Check a circuit is unitary by checking if all operations are of type ``Gate``."""

for instruction in circuit.data:
if not isinstance(instruction.operation, Gate):
if not isinstance(instruction.operation, (Gate, Barrier)):
raise CircuitError(
(
"One or more instructions cannot be converted to"
Expand Down
3 changes: 2 additions & 1 deletion qiskit/circuit/library/phase_estimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ class PhaseEstimation(QuantumCircuit):
Cambridge University Press, New York, NY, USA.
[3]: Qiskit
`textbook <https://learn.qiskit.org/course/ch-algorithms/quantum-phase-estimation>`_
`textbook <https://github.com/Qiskit/textbook/blob/main/notebooks/ch-algorithms/
quantum-phase-estimation.ipynb>`_
"""

Expand Down
25 changes: 7 additions & 18 deletions qiskit/circuit/quantumcircuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ def tensor(self, other: "QuantumCircuit", inplace: bool = False) -> Optional["Qu
Remember that in the little-endian convention the leftmost operation will be at the bottom
of the circuit. See also
`the docs <qiskit.org/documentation/tutorials/circuits/3_summary_of_quantum_operations.html>`__
`the docs <https://docs.quantum-computing.ibm.com/build/circuit-construction>`__
for more information.
.. parsed-literal::
Expand Down Expand Up @@ -2850,23 +2850,12 @@ def barrier(self, *qargs: QubitSpecifier, label=None) -> InstructionSet:
"""
from .barrier import Barrier

qubits: list[QubitSpecifier] = []

if not qargs: # None
qubits.extend(self.qubits)

for qarg in qargs:
if isinstance(qarg, QuantumRegister):
qubits.extend([qarg[j] for j in range(qarg.size)])
elif isinstance(qarg, list):
qubits.extend(qarg)
elif isinstance(qarg, range):
qubits.extend(list(qarg))
elif isinstance(qarg, slice):
qubits.extend(self.qubits[qarg])
else:
qubits.append(qarg)

qubits = (
# This uses a `dict` not a `set` to guarantee a deterministic order to the arguments.
list({q: None for qarg in qargs for q in self.qbit_argument_conversion(qarg)})
if qargs
else self.qubits.copy()
)
return self.append(Barrier(len(qubits), label=label), qubits, [])

def delay(
Expand Down
6 changes: 3 additions & 3 deletions qiskit/providers/fake_provider/fake_backend_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(self):
None,
name="FakeV2",
description="A fake BackendV2 example",
online_date=datetime.datetime.utcnow(),
online_date=datetime.datetime.now(datetime.timezone.utc),
backend_version="0.0.1",
)
self._qubit_properties = [
Expand Down Expand Up @@ -116,7 +116,7 @@ def __init__(self, bidirectional=True):
None,
name="Fake5QV2",
description="A fake BackendV2 example",
online_date=datetime.datetime.utcnow(),
online_date=datetime.datetime.now(datetime.timezone.utc),
backend_version="0.0.1",
)
qubit_properties = [
Expand Down Expand Up @@ -188,7 +188,7 @@ def __init__(self):
None,
name="FakeSimpleV2",
description="A fake simple BackendV2 example",
online_date=datetime.datetime.utcnow(),
online_date=datetime.datetime.now(datetime.timezone.utc),
backend_version="0.0.1",
)
self._lam = Parameter("lambda")
Expand Down
2 changes: 1 addition & 1 deletion qiskit/providers/fake_provider/fake_mumbai_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(self):
super().__init__(
name="FakeMumbaiFractionalCX",
description="A fake BackendV2 example based on IBM Mumbai",
online_date=datetime.datetime.utcnow(),
online_date=datetime.datetime.now(datetime.timezone.utc),
backend_version="0.0.1",
)
dt = 0.2222222222222222e-9
Expand Down
3 changes: 1 addition & 2 deletions qiskit/pulse/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ def __init__(self, index: int):
"""
self._validate_index(index)
self._index = index
self._hash = hash((self.__class__.__name__, self._index))

@property
def index(self) -> Union[int, ParameterExpression]:
Expand Down Expand Up @@ -156,7 +155,7 @@ def __eq__(self, other: "Channel") -> bool:
return type(self) is type(other) and self._index == other._index

def __hash__(self):
return self._hash
return hash((type(self), self._index))


class PulseChannel(Channel, metaclass=ABCMeta):
Expand Down
Loading

0 comments on commit 3b9225b

Please sign in to comment.