Skip to content

Commit

Permalink
Updating dependencies (#47)
Browse files Browse the repository at this point in the history
* Updating dependencies
  • Loading branch information
idavis authored Nov 27, 2023
1 parent 054b7ad commit 0b61bc8
Show file tree
Hide file tree
Showing 21 changed files with 61 additions and 43 deletions.
18 changes: 16 additions & 2 deletions .ado/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ strategy:
python.version: '3.8'
Python39:
python.version: '3.9'
Python310:
python.version: '3.10'
Python311:
python.version: '3.11'

steps:
- task: UsePythonVersion@0
Expand All @@ -20,10 +24,20 @@ steps:
displayName: 'Use Python $(python.version)'

- script: |
python -m pip install wheel --upgrade pip
python -m pip install --upgrade pip
python -m pip install -r requirements_dev.txt
make dist
python -m pip install dist/*.whl
displayName: 'Build package'
- script: |
python -m pip install dist/*.whl
displayName: 'Install package'
- script: |
pytest
displayName: 'Test package'
- publish: dist
artifact: Wheels
displayName: Upload Python Artifacts
condition: eq(variables['python.version'], '3.8')

- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
displayName: 'Component Detection'
5 changes: 2 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9']
python-version: ['3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v1
Expand All @@ -21,12 +21,11 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Build package
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements_dev.txt
make dist
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install dist/*.whl
python -m pip install pytest
- name: Run tests
run: pytest
19 changes: 10 additions & 9 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
wheel>=0.38.1
watchdog==0.9.0
flake8==3.7.8
tox==3.14.0
coverage==4.5.4
wheel>=0.41
watchdog==3.0.0
flake8==6.1.0
tox==4.11.3
coverage==7.3.2
Sphinx==1.8.5
twine==1.14.0
pytest==6.2.4
black==21.7b0
pyqir==0.8.0
twine==4.0.2
pytest==7.4.3
black==23.11.0
pyqir==0.10.0
qiskit-terra>=0.19.2,<1.0
12 changes: 6 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = qiskit-qir
version = 0.3.2
version = 0.4.0
author = Microsoft
author_email = [email protected]
description = Qiskit to QIR translator
Expand All @@ -15,11 +15,11 @@ classifiers =
License :: OSI Approved :: MIT License
Natural Language :: English
Programming Language :: Python :: 3
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Operating System :: Microsoft
Operating System :: MacOS
Operating System :: Unix
Expand All @@ -28,11 +28,11 @@ classifiers =
package_dir =
= src
packages = find:
python_requires = >=3.7
python_requires = >=3.8
install_requires =
qiskit >= 0.34.2
qiskit-terra >= 0.19.2
pyqir == 0.8.0
qiskit>=0.34.2,<1.0
qiskit-terra>=0.19.2,<1.0
pyqir>=0.10.0,<0.11.0

[options.extras_require]
test = pytest
Expand Down
2 changes: 1 addition & 1 deletion src/qiskit_qir/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
##
__author__ = """Microsoft Corporation"""
__email__ = "[email protected]"
__version__ = "0.3.2"
__version__ = "0.4.0"

from qiskit_qir.translate import to_qir_module
2 changes: 1 addition & 1 deletion src/qiskit_qir/visitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def process_composite_instruction(
f"Composite instruction {instruction.name} called with the wrong number of classical bits; \
{subcircuit.num_clbits} expected, {len(cargs)} provided"
)
for (inst, i_qargs, i_cargs) in subcircuit.data:
for inst, i_qargs, i_cargs in subcircuit.data:
mapped_qbits = [qargs[subcircuit.qubits.index(i)] for i in i_qargs]
mapped_clbits = [cargs[subcircuit.clbits.index(i)] for i in i_cargs]
_log.debug(
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/test_single_clbit_variations_falsy.ll
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ declare void @__quantum__qis__mz__body(%Qubit*, %Result* writeonly) #1

declare i1 @__quantum__qis__read_result__body(%Result*)

attributes #0 = { "entry_point" "num_required_qubits"="2" "num_required_results"="2" "output_labeling_schema" "qir_profiles"="custom" }
attributes #0 = { "entry_point" "output_labeling_schema" "qir_profiles"="custom" "required_num_qubits"="2" "required_num_results"="2" }
attributes #1 = { "irreversible" }

!llvm.module.flags = !{!0, !1, !2, !3}
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/test_single_clbit_variations_truthy.ll
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ declare void @__quantum__qis__mz__body(%Qubit*, %Result* writeonly) #1

declare i1 @__quantum__qis__read_result__body(%Result*)

attributes #0 = { "entry_point" "num_required_qubits"="2" "num_required_results"="2" "output_labeling_schema" "qir_profiles"="custom" }
attributes #0 = { "entry_point" "output_labeling_schema" "qir_profiles"="custom" "required_num_qubits"="2" "required_num_results"="2" }
attributes #1 = { "irreversible" }

!llvm.module.flags = !{!0, !1, !2, !3}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ declare void @__quantum__qis__mz__body(%Qubit*, %Result* writeonly) #1

declare i1 @__quantum__qis__read_result__body(%Result*)

attributes #0 = { "entry_point" "num_required_qubits"="2" "num_required_results"="2" "output_labeling_schema" "qir_profiles"="custom" }
attributes #0 = { "entry_point" "output_labeling_schema" "qir_profiles"="custom" "required_num_qubits"="2" "required_num_results"="2" }
attributes #1 = { "irreversible" }

!llvm.module.flags = !{!0, !1, !2, !3}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ declare void @__quantum__qis__mz__body(%Qubit*, %Result* writeonly) #1

declare i1 @__quantum__qis__read_result__body(%Result*)

attributes #0 = { "entry_point" "num_required_qubits"="2" "num_required_results"="2" "output_labeling_schema" "qir_profiles"="custom" }
attributes #0 = { "entry_point" "output_labeling_schema" "qir_profiles"="custom" "required_num_qubits"="2" "required_num_results"="2" }
attributes #1 = { "irreversible" }

!llvm.module.flags = !{!0, !1, !2, !3}
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/test_single_register_variations_falsy.ll
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ declare void @__quantum__qis__mz__body(%Qubit*, %Result* writeonly) #1

declare i1 @__quantum__qis__read_result__body(%Result*)

attributes #0 = { "entry_point" "num_required_qubits"="2" "num_required_results"="2" "output_labeling_schema" "qir_profiles"="custom" }
attributes #0 = { "entry_point" "output_labeling_schema" "qir_profiles"="custom" "required_num_qubits"="2" "required_num_results"="2" }
attributes #1 = { "irreversible" }

!llvm.module.flags = !{!0, !1, !2, !3}
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/test_single_register_variations_truthy.ll
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ declare void @__quantum__qis__mz__body(%Qubit*, %Result* writeonly) #1

declare i1 @__quantum__qis__read_result__body(%Result*)

attributes #0 = { "entry_point" "num_required_qubits"="2" "num_required_results"="2" "output_labeling_schema" "qir_profiles"="custom" }
attributes #0 = { "entry_point" "output_labeling_schema" "qir_profiles"="custom" "required_num_qubits"="2" "required_num_results"="2" }
attributes #1 = { "irreversible" }

!llvm.module.flags = !{!0, !1, !2, !3}
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/test_two_bit_register_variations_falsy.ll
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ declare void @__quantum__qis__mz__body(%Qubit*, %Result* writeonly) #1

declare i1 @__quantum__qis__read_result__body(%Result*)

attributes #0 = { "entry_point" "num_required_qubits"="3" "num_required_results"="3" "output_labeling_schema" "qir_profiles"="custom" }
attributes #0 = { "entry_point" "output_labeling_schema" "qir_profiles"="custom" "required_num_qubits"="3" "required_num_results"="3" }
attributes #1 = { "irreversible" }

!llvm.module.flags = !{!0, !1, !2, !3}
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/test_two_bit_register_variations_three.ll
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ declare void @__quantum__qis__mz__body(%Qubit*, %Result* writeonly) #1

declare i1 @__quantum__qis__read_result__body(%Result*)

attributes #0 = { "entry_point" "num_required_qubits"="3" "num_required_results"="3" "output_labeling_schema" "qir_profiles"="custom" }
attributes #0 = { "entry_point" "output_labeling_schema" "qir_profiles"="custom" "required_num_qubits"="3" "required_num_results"="3" }
attributes #1 = { "irreversible" }

!llvm.module.flags = !{!0, !1, !2, !3}
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/test_two_bit_register_variations_truthy.ll
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ declare void @__quantum__qis__mz__body(%Qubit*, %Result* writeonly) #1

declare i1 @__quantum__qis__read_result__body(%Result*)

attributes #0 = { "entry_point" "num_required_qubits"="3" "num_required_results"="3" "output_labeling_schema" "qir_profiles"="custom" }
attributes #0 = { "entry_point" "output_labeling_schema" "qir_profiles"="custom" "required_num_qubits"="3" "required_num_results"="3" }
attributes #1 = { "irreversible" }

!llvm.module.flags = !{!0, !1, !2, !3}
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/test_two_bit_register_variations_two.ll
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ declare void @__quantum__qis__mz__body(%Qubit*, %Result* writeonly) #1

declare i1 @__quantum__qis__read_result__body(%Result*)

attributes #0 = { "entry_point" "num_required_qubits"="3" "num_required_results"="3" "output_labeling_schema" "qir_profiles"="custom" }
attributes #0 = { "entry_point" "output_labeling_schema" "qir_profiles"="custom" "required_num_qubits"="3" "required_num_results"="3" }
attributes #1 = { "irreversible" }

!llvm.module.flags = !{!0, !1, !2, !3}
Expand Down
3 changes: 2 additions & 1 deletion tests/test_batching.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def get_parameterized_circuit(num_qubits: int, num_params: int) -> List[QuantumC
circuit.measure(0, 0)

circuits = [
circuit.bind_parameters({theta: theta_val}) for theta_val in theta_range
circuit.assign_parameters({theta: theta_val}, inplace=False)
for theta_val in theta_range
]

return circuits
Expand Down
2 changes: 1 addition & 1 deletion tests/test_circuits/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"teleport",
"unroll",
"teleport_with_subroutine",
"measure_x_as_subroutine"
"measure_x_as_subroutine",
] + random_fixtures

noop_tests = ["bernstein_vazirani_with_delay", "ghz_with_delay"]
5 changes: 3 additions & 2 deletions tests/test_circuits/basic_circuits.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def bernstein_vazirani_with_delay():
oracle = oracle[::-1]
for index in range(num_qubits):
if oracle[index] == "0":
circuit.i(index)
circuit.id(index)
else:
circuit.cx(index, num_qubits)

Expand Down Expand Up @@ -118,9 +118,10 @@ def ghz_with_delay():

return circuit


@pytest.fixture()
def measure_x_as_subroutine():
measure_x_circuit = QuantumCircuit(1, 1, name='measure_x')
measure_x_circuit = QuantumCircuit(1, 1, name="measure_x")
measure_x_circuit.h(0)
measure_x_circuit.measure(0, 0)
measure_x_circuit.h(0)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_circuits/control_flow_circuits.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def for_loop():
circuit = QuantumCircuit(4, 0)
circuit.name = "Simple for-loop circuit"
circuit.h(3)
with circuit.for_loop(range(3)) as q:
with circuit.for_loop(range(3)):
# Qiskit doesn't (yet) support cnot(3, i)
circuit.cnot(3, 0)
circuit.cx(3, 0)
return circuit


Expand Down
12 changes: 7 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
[tox]
envlist = py37, py38, py39, flake8
envlist = py38, py39, py310, py311, py312, black

[travis]
python =
3.12: py312
3.11: py311
3.10: py310
3.9: py39
3.8: py38
3.7: py37

[testenv:flake8]
[testenv:black]
basepython = python
deps = flake8
commands = flake8 src tests
deps = black
commands = black --check src tests

[testenv]
setenv =
Expand Down

0 comments on commit 0b61bc8

Please sign in to comment.