Skip to content

Commit

Permalink
Consolidate pip install calls in CI (Qiskit#9757)
Browse files Browse the repository at this point in the history
* Remove unnecessary `pip install` in CI

* Consolidate `pip install` calls in CI

* Add back `-U`

* Go back to editable install so Rust is in debug mode

* Add RUST_DEBUG env var so we can avoid editable install

* Remove SETUPTOOLS_ENABLE_FEATURES and also Aer from lint job

* See if editable install fixes Pylint

* Give up on not using editable installs in CI

I don't know why they're causing issues with loading the Rust extension. But it's not a priority
to figure that out. This PR is still some forward progress.
  • Loading branch information
Eric-Arellano authored and t-imamichi committed Mar 20, 2023
1 parent 2afcebc commit 0f352f9
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 19 deletions.
9 changes: 5 additions & 4 deletions .azure/lint-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ jobs:
python -m pip install --upgrade pip setuptools wheel virtualenv
virtualenv test-job
source test-job/bin/activate
pip install -U -r requirements.txt -r requirements-dev.txt -c constraints.txt
pip install -U -c constraints.txt -e .
pip install -U "qiskit-aer" -c constraints.txt
pip install -e .
pip install -U \
-c constraints.txt \
-r requirements.txt \
-r requirements-dev.txt \
-e .
displayName: 'Install dependencies'
env:
SETUPTOOLS_ENABLE_FEATURES: "legacy-editable"
Expand Down
26 changes: 19 additions & 7 deletions .azure/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,27 +60,37 @@ jobs:
# Use stable Rust, rather than MSRV, to spot-check that stable builds properly.
rustup override set stable
source test-job/bin/activate
pip install -U -r requirements.txt -r requirements-dev.txt -c constraints.txt
# Install setuptools-rust for building sdist
pip install -U -c constraints.txt setuptools-rust
python setup.py sdist
pip install -U -c constraints.txt dist/qiskit-terra*.tar.gz
pip install -U \
-c constraints.txt \
-r requirements.txt \
-r requirements-dev.txt \
dist/qiskit-terra*.tar.gz
displayName: "Install Terra from sdist"
- ${{ if eq(parameters.installFromSdist, false) }}:
- bash: |
set -e
source test-job/bin/activate
pip install -U -r requirements.txt -r requirements-dev.txt -c constraints.txt
pip install -U -c constraints.txt -e .
pip install -U \
-c constraints.txt \
-r requirements.txt \
-r requirements-dev.txt \
-e .
displayName: "Install Terra directly"
env:
SETUPTOOLS_ENABLE_FEATURES: "legacy-editable"
- bash: |
set -e
source test-job/bin/activate
pip install -U "cplex;python_version < '3.11'" "qiskit-aer" "z3-solver" -c constraints.txt
pip install -U \
-c constraints.txt \
"cplex;python_version < '3.11'" \
"qiskit-aer" \
"z3-solver"
mkdir -p /tmp/terra-tests
cp -r test /tmp/terra-tests/.
cp .stestr.conf /tmp/terra-tests/.
Expand Down Expand Up @@ -162,8 +172,10 @@ jobs:
- bash: |
set -e
virtualenv image_tests
image_tests/bin/pip install -U -r requirements.txt -c constraints.txt
image_tests/bin/pip install -U -c constraints.txt -e ".[visualization]"
image_tests/bin/pip install -U \
-c constraints.txt \
-r requirements.txt \
-e ".[visualization]"
sudo apt-get update
sudo apt-get install -y graphviz pandoc
image_tests/bin/pip check
Expand Down
7 changes: 5 additions & 2 deletions .azure/test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ jobs:
python -m pip install --upgrade pip setuptools wheel virtualenv
virtualenv test-job
source test-job/bin/activate
pip install -U -r requirements.txt -r requirements-dev.txt -c constraints.txt
pip install -U -c constraints.txt -e .
pip install -U \
-c constraints.txt \
-r requirements.txt \
-r requirements-dev.txt \
-e .
pip check
displayName: 'Install dependencies'
env:
Expand Down
9 changes: 6 additions & 3 deletions .azure/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ jobs:
python -m pip install --upgrade pip setuptools wheel virtualenv
virtualenv test-job
source test-job/Scripts/activate
pip install -r requirements.txt -r requirements-dev.txt -c constraints.txt
pip install -c constraints.txt -e .
pip install "z3-solver" -c constraints.txt
pip install -U \
-c constraints.txt \
-r requirements.txt \
-r requirements-dev.txt \
"z3-solver" \
-e .
pip check
displayName: 'Install dependencies'
env:
Expand Down
17 changes: 14 additions & 3 deletions .azure/tutorials-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,20 @@ jobs:
set -e
git clone https://github.com/Qiskit/qiskit-tutorials --depth=1
python -m pip install --upgrade pip
pip install -U -r requirements.txt -r requirements-dev.txt -c constraints.txt
pip install -c constraints.txt -e .
pip install "qiskit-ibmq-provider" "qiskit-aer" "z3-solver" "networkx" "matplotlib>=3.3.0" sphinx nbsphinx sphinx_rtd_theme cvxpy -c constraints.txt
pip install -U \
-c constraints.txt \
-r requirements.txt \
-r requirements-dev.txt \
"qiskit-ibmq-provider" \
"qiskit-aer" \
"z3-solver" \
"networkx" \
"matplotlib>=3.3.0" \
sphinx \
nbsphinx \
sphinx_rtd_theme \
cvxpy \
-e .
sudo apt-get update
sudo apt-get install -y graphviz pandoc
pip check
Expand Down
4 changes: 4 additions & 0 deletions releasenotes/notes/fix-qasm-reset-e3c6ffb1cd81d44e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
fixes:
- |
Fixed :meth:`~.QuantumCircuit.qasm` so that it appends ``;`` after ``reset`` instruction.
12 changes: 12 additions & 0 deletions test/python/circuit/test_circuit_qasm.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,18 @@ def test_circuit_qasm_with_permutations(self):
permutation__2_1_0_ q[0],q[1],q[2];\n"""
self.assertEqual(qc.qasm(), expected_qasm)

def test_circuit_qasm_with_reset(self):
"""Test circuit qasm() method with Reset."""
qc = QuantumCircuit(2)
qc.reset([0, 1])

expected_qasm = """OPENQASM 2.0;
include "qelib1.inc";
qreg q[2];
reset q[0];
reset q[1];\n"""
self.assertEqual(qc.qasm(), expected_qasm)


if __name__ == "__main__":
unittest.main()

0 comments on commit 0f352f9

Please sign in to comment.