Skip to content

Commit da69b2e

Browse files
authored
Merge pull request #206 from BQSKit/py312-support
Added Python 3.12 Support
2 parents 2b305df + dee04c1 commit da69b2e

File tree

7 files changed

+16
-8
lines changed

7 files changed

+16
-8
lines changed

.github/workflows/tests.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
python-version: ['3.8', '3.9', '3.10', '3.11']
13+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
1414
os: [macOS-latest, windows-latest, ubuntu-latest]
1515

1616
runs-on: ${{ matrix.os }}
@@ -19,10 +19,17 @@ jobs:
1919
- uses: actions/setup-python@v2
2020
with:
2121
python-version: ${{ matrix.python-version }}
22+
2223
- name: Upgrade python environment
2324
run: python -m pip install --upgrade virtualenv setuptools pip
25+
2426
- name: Upgrade test dependencies
25-
run: python -m pip install psutil pytest 'hypothesis[zoneinfo]' qiskit
27+
run: python -m pip install psutil pytest 'hypothesis[zoneinfo]'
28+
29+
- name: Upgrade optional test dependencies
30+
if: matrix.python-version != '3.12'
31+
run: python -m pip install qiskit
32+
2633
- name: Install BQSKit
2734
env:
2835
SYSTEM_VERSION_COMPAT: 0

bqskit/compiler/workflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def name(self) -> str:
9090
def __str__(self) -> str:
9191
name_seq = f'Workflow: {self.name}\n\t'
9292
pass_strs = [
93-
f'{i}. {"Workflow: " + p.name if isinstance(p, Workflow) else p}'
93+
f'{i}. {'Workflow: ' + p.name if isinstance(p, Workflow) else p}'
9494
for i, p in enumerate(self._passes)
9595
]
9696
return name_seq + '\n\t'.join(pass_strs)

bqskit/passes/mapping/placement/trivial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ async def run(self, circuit: Circuit, data: PassData) -> None:
2020
model = BasePass.get_model(circuit, data)
2121
data['placement'] = trivial_placement
2222

23-
_logger.info(f'Placed qudits on {data["placement"]}')
23+
_logger.info(f'Placed qudits on {data['placement']}')
2424

2525
# Raise an error if this is not a valid placement
2626
sg = model.coupling_graph.get_subgraph(data['placement'])

bqskit/runtime/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def connect_to_managers(self, ipports: Sequence[tuple[str, int]]) -> None:
170170
selectors.EVENT_READ,
171171
MessageDirection.BELOW,
172172
)
173-
self.logger.info(f'Registered manager {i} with {num_workers = }.')
173+
self.logger.info(f'Registered manager {i} with {num_workers=}.')
174174
self.total_workers += num_workers
175175
self.num_idle_workers = self.total_workers
176176

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ requires = [
99
legacy_tox_ini = """
1010
[tox]
1111
minversion = 3.3.0
12-
envlist = pre-commit,py38,py39,py310,py311
12+
envlist = pre-commit,py38,py39,py310,py311,py312
1313
skip_missing_interpreters = true
1414
1515
[testenv]
@@ -32,7 +32,7 @@ commands =
3232
skip_install = true
3333
deps = pre-commit
3434
commands = pre-commit run --all-files --show-diff-on-failure
35-
basepython=py311
35+
basepython=py312
3636
"""
3737

3838
[tool.pytest.ini_options]

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
'Programming Language :: Python :: 3.9',
4646
'Programming Language :: Python :: 3.10',
4747
'Programming Language :: Python :: 3.11',
48+
'Programming Language :: Python :: 3.12',
4849
'Topic :: Scientific/Engineering',
4950
'Topic :: Scientific/Engineering :: Mathematics',
5051
'Topic :: Scientific/Engineering :: Physics',

tests/compiler/compile/test_pam_verify.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ def test_pam_verify(compiler: Compiler, medium_qasm_file: str) -> None:
2525
PI = PermutationMatrix.from_qubit_location(out_circuit.num_qudits, pi)
2626
PF = PermutationMatrix.from_qubit_location(out_circuit.num_qudits, pf)
2727
exact_error = out_utry.get_distance_from(PF.T @ circuit.get_unitary() @ PI)
28-
assert upper_bound_error >= exact_error
28+
assert upper_bound_error >= exact_error or abs(upper_bound_error - exact_error) < 5e-7

0 commit comments

Comments
 (0)