File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77.. image :: https://circleci.com/gh/dwavesystems/dwave-gate.svg?style=svg
88 :target: https://circleci.com/gh/dwavesystems/dwave-gate
99
10- .. image :: https://codecov.io/gh/dwavesystems/dwave-gate/branch/master /graph/badge.svg
10+ .. image :: https://codecov.io/gh/dwavesystems/dwave-gate/branch/main /graph/badge.svg
1111 :target: https://codecov.io/gh/dwavesystems/dwave-gate
1212
1313dwave-gate
@@ -101,6 +101,15 @@ Tests and coverage can be run using Pytest.
101101
102102 python -m pytest tests/ --cov=dwave.gate
103103
104+ .. note ::
105+
106+ For the QIR compiler and loader to work the PyQIR (v0.9.0) is required. It can be
107+ installed manually with ``pip install pyqir==0.9.0 `` or as an optional dependency:
108+
109+ .. code-block :: bash
110+
111+ pip install dwave-gate[qir]
112+
104113.. installation-end-marker
105114
106115 License
Original file line number Diff line number Diff line change 77.. image :: https://circleci.com/gh/dwavesystems/dwave-gate.svg?style=svg
88 :target: https://circleci.com/gh/dwavesystems/dwave-gate
99
10- .. image :: https://codecov.io/gh/dwavesystems/dwave-gate/branch/master /graph/badge.svg
10+ .. image :: https://codecov.io/gh/dwavesystems/dwave-gate/branch/main /graph/badge.svg
1111 :target: https://codecov.io/gh/dwavesystems/dwave-gate
1212
1313dwave-gate
@@ -81,7 +81,7 @@ It can also be installed from source by cloning this GitHub repository and runni
8181 make install
8282
8383 The makefile will also simplify running tests (``make test ``), coverage (``make coverage ``),
84- documentation (``make docs` `` ), as well as formatting (``make format ``) the code using the `Black
84+ documentation (``make docs ``), as well as formatting (``make format ``) the code using the `Black
8585<https://black.readthedocs.io/> `_ formatter (set to a line-length of 100) and `isort
8686<https://pycqa.github.io/isort/> `_. It's available on both Unix as well as Windows systems, via the
8787`make.bat ` batch file.
@@ -99,7 +99,16 @@ Tests and coverage can be run using Pytest.
9999
100100.. code-block :: bash
101101
102- pytest tests/ --cov=dwave.gate
102+ python -m pytest tests/ --cov=dwave.gate
103+
104+ .. note ::
105+
106+ For the QIR compiler and loader to work the optional dependency PyQIR (v0.9.0) is required. It can be
107+ installed manually with ``pip install pyqir==0.9.0 `` or from PyPI as an extra:
108+
109+ .. code-block :: bash
110+
111+ pip install dwave-gate[qir]
103112
104113.. installation-end-marker
105114
Original file line number Diff line number Diff line change @@ -13,3 +13,4 @@ Reference Documentation
1313 registers
1414 simulator
1515 tools
16+ qir
Original file line number Diff line number Diff line change 1+ QIR
2+ ===
3+
4+ .. automodule :: dwave.gate.qir
5+ :members:
6+ :undoc-members:
7+ :show-inheritance:
8+
9+ Compiler Module
10+ ---------------
11+
12+ .. automodule :: dwave.gate.qir.compiler
13+ :members:
14+ :undoc-members:
15+ :show-inheritance:
16+
17+ Instructions Module
18+ -------------------
19+
20+ .. automodule :: dwave.gate.qir.instructions
21+ :members:
22+ :undoc-members:
23+ :show-inheritance:
24+
25+ Loader Module
26+ -------------
27+
28+ .. automodule :: dwave.gate.qir.loader
29+ :members:
30+ :undoc-members:
31+ :show-inheritance:
Original file line number Diff line number Diff line change 1717Contains the QIR compiler, loader and related files and functions.
1818"""
1919
20- from typing import Tuple
21-
2220try :
2321 import pyqir # noqa: F401
24- except ImportError : # pragma: no cover
25- pyqir_installed = False
26- else :
27- # pyqir>=0.8 required
28- from importlib .metadata import version
29-
30- def parse (version : str ) -> Tuple [str , str , str ]:
31- "Parse a MAJOR.MINOR.PATCH version string into a tuple."
32- return tuple (version .split ("." ))[:3 ]
33-
34- pyqir_installed = parse (version ("pyqir" )) >= parse ("0.8.0" )
22+ except ImportError as e : # pragma: no cover
23+ raise ImportError ("PyQIR required for using the QIR compiler" ) from e
3524
36- if not pyqir_installed : # pragma: no cover
37- raise ImportError ("PyQIR not installed." )
3825
3926from dwave .gate .qir .compiler import *
4027from dwave .gate .qir .loader import *
Original file line number Diff line number Diff line change @@ -57,15 +57,15 @@ def refresh(cls) -> None:
5757 except StopIteration :
5858 cls .length += 1
5959 if cls .length > len (cls ._alphanum ):
60+ if not cls .id_set :
61+ raise ValueError (
62+ "ID length cannot be longer than number of unique characters available."
63+ )
6064 warnings .warn (
6165 f"Insufficient characters to generate unique ID of length { cls .length } or "
6266 f"longer. Generated batch of { len (cls .id_set )} instead of requested "
6367 f"batch size of { cls .batch } IDs"
6468 )
65- if not cls .id_set :
66- raise ValueError (
67- "ID length cannot be longer than number of unique characters available."
68- )
6969 break
7070
7171 cls ._id_gen = itertools .combinations (cls ._alphanum , r = cls .length )
Original file line number Diff line number Diff line change @@ -34,6 +34,10 @@ requires-python = ">= 3.8"
3434dependencies = [
3535 " numpy>=1.24.4" ,
3636]
37+ [project .optional-dependencies ]
38+ qir = [
39+ " pyqir>=0.8.0,<0.10" ,
40+ ]
3741
3842[project .readme ]
3943file = " README.rst"
@@ -46,7 +50,7 @@ Download = "https://github.com/dwavesystems/dwave-gate/releases"
4650[tool .cibuildwheel ]
4751build-verbosity = " 1"
4852skip = " pp* *musllinux*"
49- before-test = " pip install pyqir==0.8.2 && pip install -r {project}/requirements_dev.txt"
53+ before-test = " pip install pyqir==0.9.0 && pip install -r {project}/requirements_dev.txt"
5054test-command = " pytest {project}/tests"
5155before-build = " pip install cgen==2020.1 && python {project}/dwave/gate/simulator/operation_generation.py"
5256
Original file line number Diff line number Diff line change 1+ ---
2+ fixes :
3+ - |
4+ Remove PyQIR version check as it's been added as an optional dependency. A supported
5+ version can now be installed directly with ``pip install dwave-gate[qir]``.
Original file line number Diff line number Diff line change 1+ # working environment for Python>=3.8,<=3.11
12numpy == 1.24.4
2- cython == 3.0.4
3+ cython == 3.0.10
34cgen == 2020.1
4- pyqir == 0.8.2
5+ pyqir == 0.9.0
Original file line number Diff line number Diff line change 1- pytest= =7.2.0
2- pytest-cov= =4.0.0
3- pytest-mock= =3.10.0
4- typing_extensions= =4.4.0
1+ pytest> =7.2.0
2+ pytest-cov> =4.0.0
3+ pytest-mock> =3.10.0
4+ typing_extensions> =4.4.0
You can’t perform that action at this time.
0 commit comments