Skip to content

Commit

Permalink
Merge branch 'main' into runtime-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
edyounis committed Aug 27, 2024
2 parents e72a6e4 + 064d58e commit dc5152e
Show file tree
Hide file tree
Showing 57 changed files with 2,699 additions and 271 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/nightly-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Runs slow tests every night
name: nightly tests

on:
schedule:
- cron: "21 2 * * *"

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.12

- 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

- name: Install BQSKit
env:
SYSTEM_VERSION_COMPAT: 0
run: pip install .

- name: Run tests
env:
NUMBER_RANDOM_CIRCUITS: 100
run: pytest
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.11'
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/publish-on-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Publish Release
on:
release:

jobs:
build:
name: Build distribution
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install build tool
run: python -m pip install build --user

- name: Build distribution packages
run: python -m build

- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: Upload release to PyPI

needs:
- build

runs-on: ubuntu-latest
environment:
name: release
url: https://pypi.org/p/bqskit

permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
16 changes: 7 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,23 @@ jobs:

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
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]'

- name: Upgrade optional test dependencies
if: matrix.python-version != '3.12'
run: python -m pip install qiskit
run: python -m pip install psutil pytest 'hypothesis[zoneinfo]' qiskit

- name: Install BQSKit
env:
SYSTEM_VERSION_COMPAT: 0
NUMBER_RANDOM_CIRCUITS: 100
run: pip install .

- name: Run tests
run: pytest
env:
NUMBER_RANDOM_CIRCUITS: 100
run: pytest --ignore=tests/compiler/compile --ignore=tests/passes/partitioning/test_parts.py --ignore=tests/passes/synthesis/test_qfast.py
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ci:
skip: [mypy]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand Down Expand Up @@ -30,7 +30,7 @@ repos:
- --wrap-summaries=80
- --wrap-descriptions=80
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v2.0.2
rev: v2.0.4
hooks:
- id: autopep8
args:
Expand All @@ -39,13 +39,13 @@ repos:
- --ignore=E731
exclude: 'tests/ext.*'
- repo: https://github.com/asottile/pyupgrade
rev: v3.10.1
rev: v3.17.0
hooks:
- id: pyupgrade
args:
- --py38-plus
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.10.0
rev: v3.13.0
hooks:
- id: reorder-python-imports
args:
Expand All @@ -54,25 +54,25 @@ repos:
- --py37-plus
exclude: 'tests/ext.*'
- repo: https://github.com/asottile/add-trailing-comma
rev: v3.0.1
rev: v3.1.0
hooks:
- id: add-trailing-comma
args:
- --py36-plus
- repo: https://github.com/PyCQA/autoflake
rev: v2.2.0
rev: v2.3.1
hooks:
- id: autoflake
args:
- --in-place
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.0
rev: v1.11.1
hooks:
- id: mypy
exclude: tests/qis/test_pauli.py
additional_dependencies: ["numpy>=1.21"]
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
rev: 7.1.1
hooks:
- id: flake8
args:
Expand Down
2 changes: 1 addition & 1 deletion bqskit/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""This module contains the version information for BQSKit."""
from __future__ import annotations
__version_info__ = ('1', '1', '1')
__version_info__ = ('1', '1', '2')
__version__ = '.'.join(__version_info__[:3]) + ''.join(__version_info__[3:])
6 changes: 3 additions & 3 deletions bqskit/compiler/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
from bqskit.passes.mapping.routing.pam import PAMRoutingPass
from bqskit.passes.mapping.routing.sabre import GeneralizedSabreRoutingPass
from bqskit.passes.mapping.setmodel import ExtractModelConnectivityPass
from bqskit.passes.mapping.setmodel import RestoreModelConnevtivityPass
from bqskit.passes.mapping.setmodel import RestoreModelConnectivityPass
from bqskit.passes.mapping.setmodel import SetModelPass
from bqskit.passes.mapping.topology import SubtopologySelectionPass
from bqskit.passes.mapping.verify import PAMVerificationSequence
Expand Down Expand Up @@ -1011,7 +1011,7 @@ def build_multi_qudit_retarget_workflow(
optimization_level,
synthesis_epsilon,
),
RestoreModelConnevtivityPass(),
RestoreModelConnectivityPass(),
],
AutoRebase2QuditGatePass(3, 5, synthesis_epsilon),
),
Expand Down Expand Up @@ -1256,7 +1256,7 @@ def build_seqpam_mapping_optimization_workflow(
PAMRoutingPass(),
post_pam_seq,
UnfoldPass(),
RestoreModelConnevtivityPass(),
RestoreModelConnectivityPass(),

LogPass('Recaching permutation-aware synthesis results.'),
SubtopologySelectionPass(block_size),
Expand Down
2 changes: 1 addition & 1 deletion bqskit/ext/qiskit/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def model_from_backend(backend: BackendV1) -> MachineModel:
num_qudits = config.n_qubits
gate_set = _basis_gate_str_to_bqskit_gate(config.basis_gates)
coupling_map = list({tuple(sorted(e)) for e in config.coupling_map})
return MachineModel(num_qudits, coupling_map, gate_set) # type: ignore
return MachineModel(num_qudits, coupling_map, gate_set)


def _basis_gate_str_to_bqskit_gate(basis_gates: list[str]) -> set[Gate]:
Expand Down
Loading

0 comments on commit dc5152e

Please sign in to comment.