-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
342 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Release | ||
|
||
on: | ||
release: | ||
types: | ||
- created | ||
- edited | ||
|
||
jobs: | ||
publish: | ||
name: Publish to pypi | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
- name: Install flit | ||
run: pip install flit | ||
- name: Install pytket-qirpass | ||
run: flit install | ||
- name: Publish package | ||
env: | ||
FLIT_USERNAME: '__token__' | ||
FLIT_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | ||
run: flit publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
"""Module for optimizing QIR using pytket.""" | ||
|
||
__version__ = "0.8.0" | ||
__version__ = "0.9.0" | ||
|
||
from .apply_qirpass import apply_qirpass | ||
from .apply_qirpass import apply_qirpass as apply_qirpass | ||
from .qir_to_pytket import qir_to_pytket as qir_to_pytket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from .utils import bc_to_module, is_entry_point, to_circuit | ||
|
||
from pytket.circuit import Circuit | ||
|
||
|
||
def qir_to_pytket(qir_bitcode: bytes) -> Circuit: | ||
"""Convert QIR to a pytket circuit. | ||
:param qir_bitcode: QIR bitcode | ||
:return: pytket circuit | ||
""" | ||
module = bc_to_module(qir_bitcode) | ||
entries = [f for f in module.functions if is_entry_point(f)] | ||
assert len(entries) == 1 | ||
blocks = list(entries[0].blocks) | ||
assert len(blocks) == 1 | ||
instructions = list( | ||
filter(lambda instr: instr.opcode == "call", blocks[0].instructions) | ||
) | ||
return to_circuit(instructions) |
Oops, something went wrong.