Skip to content

Commit

Permalink
Merge pull request #91 from qBraid/rh1-release
Browse files Browse the repository at this point in the history
prepare release
  • Loading branch information
ryanhill1 authored May 10, 2024
2 parents 887c210 + 0d7532c commit eb512ad
Show file tree
Hide file tree
Showing 23 changed files with 43 additions and 828 deletions.
8 changes: 0 additions & 8 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,3 @@ body:
description: We warmly welcome any recommendations on potential fixes, insights, or considerations that contributors should keep in mind when working to resolve this issue.
validations:
required: false

- type: checkboxes
id: agreement
attributes:
label: 'Please confirm the following:'
options:
- label: 'I have searched the existing issues and confirm this is a new bug report.'
required: true
9 changes: 0 additions & 9 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,3 @@ body:
description: "Do you have an idea for how this could be implemented? Please include those details here."
validations:
required: false

- type: checkboxes
id: agreement
attributes:
label: 'Please confirm the following:'
description: 'Understanding that feature requests are evaluated for their applicability and benefit to the community, and not all requests may be implemented.'
options:
- label: 'I have searched the existing issues and confirm this is a new feature request.'
required: true
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ jobs:
run: |
black --check qbraid_qir tests tools examples
isort --check-only qbraid_qir tests tools
python tools/verify_headers.py qbraid_qir tests
qbraid admin headers qbraid_qir tests
14 changes: 7 additions & 7 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ message: >-
metadata from this file.
type: software
authors:
- given-names: Harshit
family-names: Gupta
affiliation: qBraid Co.
- given-names: Samuel
family-names: Kushnir
affiliation: University of Maryland
Expand All @@ -15,15 +18,12 @@ authors:
- given-names: Priyansh
family-names: Parakh
affiliation: University of Toronto
- given-names: Harshit
family-names: Gupta
affiliation: VISA Inc.
- given-names: Ryan James
family-names: Hill
affiliation: qBraid Co.
repository-code: 'https://github.com/qBraid/qbraid-qir'
url: 'https://docs.qbraid.com/projects/qir/en/v0.1.1/'
repository-artifact: 'https://github.com/qBraid/qbraid-qir/releases/tag/v0.1.1'
url: 'https://docs.qbraid.com/projects/qir/en/v0.2.0/'
repository-artifact: 'https://github.com/qBraid/qbraid-qir/releases/tag/v0.2.0'
keywords:
- python
- quantum-computing
Expand All @@ -32,5 +32,5 @@ keywords:
- cirq
- openasm
license: GPL-3.0
version: 0.1.1
date-released: '2024-03-04'
version: 0.2.0
date-released: '2024-05-09'
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
include *.txt *.md
recursive-include docs *.rst *.py *.png *.ico *.txt
recursive-include qbraid_qir *.py
recursive-include tools *.py
prune docs/build/
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ The BibTeX entry below is aligned with the latest stable release. For the most u
citation details, please refer to [CITATION.cff](CITATION.cff).

```tex
@software{Kushnir_qBraid-QIR_Python_package_2024,
author = {Kushnir, Samuel and Gupta, Harshit and Jain, Rohan and Parakh, Priyansh and Hill, Ryan James},
@software{Gupta_qBraid-QIR_Python_package_2024,
author = {Gupta, Harshit and Kushnir, Samuel and Jain, Rohan and Parakh, Priyansh and Hill, Ryan James},
license = {GPL-3.0},
month = mar,
month = may,
title = {{qBraid-QIR: Python package for QIR conversions, integrations, and utilities.}},
url = {https://github.com/qBraid/qbraid-qir},
version = {0.2.0},
Expand Down
7 changes: 0 additions & 7 deletions docs/api/qbraid_qir.runner.rst

This file was deleted.

8 changes: 1 addition & 7 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,13 @@
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys

import qbraid_qir

sys.path.insert(0, os.path.abspath(".."))
sys.path.insert(0, os.path.abspath("../../qbraid_qir"))

# -- Project information -----------------------------------------------------

project = "qbraid-qir"
copyright = "2023, qBraid Development Team"
copyright = "2024, qBraid Development Team"
author = "qBraid Development Team"

# The full version, including alpha/beta/rc tags
Expand Down
1 change: 0 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ This project was conceived in cooperation with the Quantum Open Source Foundatio
api/qbraid_qir
api/qbraid_qir.cirq
api/qbraid_qir.qasm3
api/qbraid_qir.runner


Indices and Tables
Expand Down
9 changes: 4 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ name = "qbraid-qir"
dynamic = ["version"]
description = "qBraid-SDK extension providing support for QIR conversions."
readme = "README.md"
authors = [{ name = "qBraid Development Team", email = "[email protected]" }]
license = { file = "LICENSE" }
authors = [{name = "qBraid Development Team"}, {email = "[email protected]"}]
license = {text = "GNU General Public License v3.0"}
keywords = ["qbraid", "quantum", "qir", "llvm", "cirq", "openqasm"]
classifiers = [
"Intended Audience :: Developers",
Expand All @@ -25,7 +25,7 @@ classifiers = [
"Topic :: Scientific/Engineering :: Physics"
]
dependencies = ["pyqir~=0.10.0", "numpy"]
requires-python = ">= 3.9"
requires-python = ">=3.9"

[project.urls]
Homepage = "https://github.com/qBraid/qbraid-qir"
Expand All @@ -38,7 +38,7 @@ Discord = "https://discord.gg/TPBU2sa8Et"
cirq = ["cirq-core>=1.3.0,<1.4.0"]
qasm3 = ["openqasm3[parser]>=0.4.0,<0.6.0"]
test = ["qbraid>=0.5.3,<0.7.0", "pytest", "pytest-cov"]
lint = ["black[jupyter]", "isort", "pylint"]
lint = ["black[jupyter]", "isort", "pylint", "qbraid-cli"]
docs = ["sphinx~=7.3.7", "sphinx-autodoc-typehints>=1.24,<2.2", "sphinx-rtd-theme~=2.0.0", "docutils<0.22"]

[tool.setuptools.dynamic]
Expand Down Expand Up @@ -74,6 +74,5 @@ exclude_lines = [
parallel = true
source = ["qbraid_qir"]
omit = [
"**/qbraid_qir/runner/simulator.py",
"**/qbraid_qir/__init__.py"
]
2 changes: 1 addition & 1 deletion qbraid_qir/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"dumps",
]

_lazy_mods = ["cirq", "qasm3", "runner"]
_lazy_mods = ["cirq", "qasm3"]


def __getattr__(name):
Expand Down
2 changes: 1 addition & 1 deletion qbraid_qir/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
Version number (major.minor.patch[-label])
"""
__version__ = "0.2.0.dev"
__version__ = "0.2.0"
1 change: 1 addition & 0 deletions qbraid_qir/qasm3/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class Variable:
"""

# pylint: disable-next=too-many-arguments
def __init__(self, name, base_type, base_size, dims, value, is_constant=False):
self.name = name
self.base_type = base_type
Expand Down
31 changes: 19 additions & 12 deletions qbraid_qir/qasm3/visitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import sys
from abc import ABCMeta, abstractmethod

# pylint: disable=too-many-instance-attributes
# pylint: disable=too-many-instance-attributes,too-many-lines
from collections import deque
from typing import Any, List, Optional, Tuple, Union

Expand Down Expand Up @@ -706,12 +706,15 @@ def _validate_variable_assignment_value(self, variable: Variable, value: Any) ->
qasm_type = base_type.__class__
try:
type_to_match = VARIABLE_TYPE_MAP[qasm_type]
except KeyError:
raise Qasm3ConversionError(f"Invalid type {qasm_type} for variable {variable.name}")
except KeyError as err:
raise Qasm3ConversionError(
f"Invalid type {qasm_type} for variable {variable.name}"
) from err

if not isinstance(value, type_to_match):
raise Qasm3ConversionError(
f"Invalid assignment of type {type(value)} to variable {variable.name} of type {qasm_type}"
f"Invalid assignment of type {type(value)} to variable {variable.name} "
f"of type {qasm_type}"
)

# check 2 - range match , if bits mentioned in base size
Expand All @@ -725,21 +728,24 @@ def _validate_variable_assignment_value(self, variable: Variable, value: Any) ->
left, right = 0, 2**base_size - 1
if value < left or value > right:
raise Qasm3ConversionError(
f"Value {value} out of limits for variable {variable.name} with base size {base_size}"
f"Value {value} out of limits for variable {variable.name} "
f"with base size {base_size}"
)

elif type_to_match == float:
base_size = variable.base_size
left, right = 0, 0
# Reference : https://openqasm.com/language/types.html#floating-point-numbers and IEEE 754 standard
# IEEE 754 Standard for floats
# https://openqasm.com/language/types.html#floating-point-numbers
if base_size == 32:
left, right = -(1.70141183 * (10**38)), (1.70141183 * (10**38))
else:
left, right = -(10**308), (10**308)

if value < left or value > right:
raise Qasm3ConversionError(
f"Value {value} out of limits for variable {variable.name} with base size {base_size}"
f"Value {value} out of limits for variable {variable.name} "
f"with base size {base_size}"
)
elif type_to_match == bool:
pass
Expand Down Expand Up @@ -768,8 +774,8 @@ def _visit_constant_declaration(self, statement: ConstantDeclaration) -> None:
self._print_err_location(statement.span)
raise Qasm3ConversionError(f"Re-declaration of variable {var_name}")

# TODO: extend to checking that only CONST vars are allowed when instantiating
# a constant variable
# TODO: extend to checking that only CONST vars are allowed
# when instantiating a constant variable
init_value = self._evaluate_expression(statement.init_expression)

base_type = statement.type
Expand Down Expand Up @@ -880,8 +886,8 @@ def _analyse_classical_indices(self, indices: List[List[Any]], var_name: str) ->
if len(indices) != len(var_dimensions):
self._print_err_location(indices[0][0].span)
raise Qasm3ConversionError(
f"Invalid number of indices for variable {var_name}. Expected {len(var_dimensions)} "
f"but got {len(indices)}"
f"Invalid number of indices for variable {var_name}. "
f"Expected {len(var_dimensions)} but got {len(indices)}"
)

for i, index in enumerate(indices):
Expand All @@ -904,7 +910,7 @@ def _analyse_classical_indices(self, indices: List[List[Any]], var_name: str) ->
raise Qasm3ConversionError(
f"Index {index_value} out of bounds for dimension {i+1} of variable {var_name}"
)
# Column major representation : https://en.wikipedia.org/wiki/Row-_and_column-major_order
# Column major representation: https://en.wikipedia.org/wiki/Row-_and_column-major_order
flat_index = flat_index + multiplier * index_value
multiplier = multiplier * curr_dimension

Expand Down Expand Up @@ -1149,6 +1155,7 @@ def visit_contextual_statement(self, statement: Statement) -> None:
def visit_scoped_statement(self, statement: Statement) -> None:
pass

# pylint: disable-next=too-many-branches
def visit_statement(self, statement: Statement) -> None:
"""Visit a statement element.
Expand Down
37 changes: 0 additions & 37 deletions qbraid_qir/runner/__init__.py

This file was deleted.

19 changes: 0 additions & 19 deletions qbraid_qir/runner/exceptions.py

This file was deleted.

Loading

0 comments on commit eb512ad

Please sign in to comment.