Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Python 3.12 Support #206

Merged
merged 5 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
os: [macOS-latest, windows-latest, ubuntu-latest]

runs-on: ${{ matrix.os }}
Expand All @@ -19,10 +19,17 @@ jobs:
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Upgrade python environment
run: python -m pip install --upgrade virtualenv setuptools pip

- name: Upgrade test dependencies
run: python -m pip install psutil pytest 'hypothesis[zoneinfo]' qiskit
run: python -m pip install psutil pytest 'hypothesis[zoneinfo]'

- name: Upgrade optional test dependencies
if: matrix.python-version != '3.12'
run: python -m pip install qiskit

- name: Install BQSKit
env:
SYSTEM_VERSION_COMPAT: 0
Expand Down
2 changes: 1 addition & 1 deletion bqskit/compiler/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def name(self) -> str:
def __str__(self) -> str:
name_seq = f'Workflow: {self.name}\n\t'
pass_strs = [
f'{i}. {"Workflow: " + p.name if isinstance(p, Workflow) else p}'
f'{i}. {'Workflow: ' + p.name if isinstance(p, Workflow) else p}'
for i, p in enumerate(self._passes)
]
return name_seq + '\n\t'.join(pass_strs)
Expand Down
2 changes: 1 addition & 1 deletion bqskit/passes/mapping/placement/trivial.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async def run(self, circuit: Circuit, data: PassData) -> None:
model = BasePass.get_model(circuit, data)
data['placement'] = trivial_placement

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

# Raise an error if this is not a valid placement
sg = model.coupling_graph.get_subgraph(data['placement'])
Expand Down
2 changes: 1 addition & 1 deletion bqskit/runtime/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def connect_to_managers(self, ipports: Sequence[tuple[str, int]]) -> None:
selectors.EVENT_READ,
MessageDirection.BELOW,
)
self.logger.info(f'Registered manager {i} with {num_workers = }.')
self.logger.info(f'Registered manager {i} with {num_workers=}.')
self.total_workers += num_workers
self.num_idle_workers = self.total_workers

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ requires = [
legacy_tox_ini = """
[tox]
minversion = 3.3.0
envlist = pre-commit,py38,py39,py310,py311
envlist = pre-commit,py38,py39,py310,py311,py312
skip_missing_interpreters = true

[testenv]
Expand All @@ -32,7 +32,7 @@ commands =
skip_install = true
deps = pre-commit
commands = pre-commit run --all-files --show-diff-on-failure
basepython=py311
basepython=py312
"""

[tool.pytest.ini_options]
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Mathematics',
'Topic :: Scientific/Engineering :: Physics',
Expand Down
2 changes: 1 addition & 1 deletion tests/compiler/compile/test_pam_verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ def test_pam_verify(compiler: Compiler, medium_qasm_file: str) -> None:
PI = PermutationMatrix.from_qubit_location(out_circuit.num_qudits, pi)
PF = PermutationMatrix.from_qubit_location(out_circuit.num_qudits, pf)
exact_error = out_utry.get_distance_from(PF.T @ circuit.get_unitary() @ PI)
assert upper_bound_error >= exact_error
assert upper_bound_error >= exact_error or abs(upper_bound_error - exact_error) < 5e-7
Loading