From acd153604bf477899e3a42b75bda0d6a08bf9d49 Mon Sep 17 00:00:00 2001 From: Erik Davis Date: Mon, 9 Sep 2024 14:06:40 -0700 Subject: [PATCH 1/3] be explicit about openqasm3.ast imports --- source/openpulse/openpulse/ast.py | 174 +++++++++++++++++++++++++++++- 1 file changed, 172 insertions(+), 2 deletions(-) diff --git a/source/openpulse/openpulse/ast.py b/source/openpulse/openpulse/ast.py index 9f27009..eca5cb3 100644 --- a/source/openpulse/openpulse/ast.py +++ b/source/openpulse/openpulse/ast.py @@ -15,8 +15,89 @@ from typing import List, Optional, Union # Re-export the existing AST classes from openqasm3 -# pylint: disable=unused-import -from openqasm3.ast import * +# This is everything _except_ CalibrationDefinition +# and CalibrationStatement, which get redefined below. +from openqasm3.ast import ( + AccessControl, + AliasStatement, + AngleType, + Annotation, + ArrayLiteral, + ArrayReferenceType, + ArrayType, + AssignmentOperator, + BinaryExpression, + BinaryOperator, + BitType, + BitstringLiteral, + BoolType, + BooleanLiteral, + Box, + BranchingStatement, + BreakStatement, + CalibrationGrammarDeclaration, + Cast, + ClassicalArgument, + ClassicalAssignment, + ClassicalDeclaration, + ClassicalType, + ComplexType, + Concatenation, + ConstantDeclaration, + ContinueStatement, + DelayInstruction, + DiscreteSet, + DurationLiteral, + DurationOf, + DurationType, + EndStatement, + Expression, + ExpressionStatement, + ExternArgument, + ExternDeclaration, + FloatLiteral, + FloatType, + ForInLoop, + FunctionCall, + GateModifierName, + IODeclaration, + IOKeyword, + Identifier, + ImaginaryLiteral, + Include, + IndexExpression, + IndexedIdentifier, + IntType, + IntegerLiteral, + Pragma, + Program, + QASMNode, + QuantumArgument, + QuantumBarrier, + QuantumGate, + QuantumGateDefinition, + QuantumGateModifier, + QuantumMeasurement, + QuantumMeasurementStatement, + QuantumPhase, + QuantumReset, + QuantumStatement, + QubitDeclaration, + RangeDefinition, + ReturnStatement, + SizeOf, + Span, + Statement, + SwitchStatement, + CompoundStatement, + StretchType, + SubroutineDefinition, + TimeUnit, + UintType, + UnaryExpression, + UnaryOperator, + WhileLoop, +) # From Pulse grammar @@ -94,3 +175,92 @@ class CalibrationDefinition(Statement): qubits: List[Identifier] return_type: Optional[ClassicalType] body: List[Statement] + + +__all__ = [ + "AccessControl", + "AliasStatement", + "AngleType", + "Annotation", + "ArrayLiteral", + "ArrayReferenceType", + "ArrayType", + "AssignmentOperator", + "BinaryExpression", + "BinaryOperator", + "BitType", + "BitstringLiteral", + "BoolType", + "BooleanLiteral", + "Box", + "BranchingStatement", + "BreakStatement", + "CalibrationBlock", + "CalibrationDefinition", + "CalibrationGrammarDeclaration", + "CalibrationStatement", + "Cast", + "ClassicalArgument", + "ClassicalAssignment", + "ClassicalDeclaration", + "ClassicalType", + "ComplexType", + "Concatenation", + "ConstantDeclaration", + "ContinueStatement", + "DelayInstruction", + "DiscreteSet", + "DurationLiteral", + "DurationOf", + "DurationType", + "EndStatement", + "Expression", + "ExpressionStatement", + "ExternArgument", + "ExternDeclaration", + "FloatLiteral", + "FloatType", + "ForInLoop", + "FrameType", + "FunctionCall", + "GateModifierName", + "IODeclaration", + "IOKeyword", + "Identifier", + "ImaginaryLiteral", + "Include", + "IndexExpression", + "IndexedIdentifier", + "IntType", + "IntegerLiteral", + "PortType", + "Pragma", + "Program", + "QASMNode", + "QuantumArgument", + "QuantumBarrier", + "QuantumGate", + "QuantumGateDefinition", + "QuantumGateModifier", + "QuantumMeasurement", + "QuantumMeasurementStatement", + "QuantumPhase", + "QuantumReset", + "QuantumStatement", + "QubitDeclaration", + "RangeDefinition", + "ReturnStatement", + "SizeOf", + "Span", + "Statement", + "SwitchStatement", + "CompoundStatement", + "StretchType", + "SubroutineDefinition", + "TimeUnit", + "UintType", + "UnaryExpression", + "UnaryOperator", + "WaveformType", + "WhileLoop", +] From b76e62e48bdb4e7602e181a51e774ee5ab7a7ce9 Mon Sep 17 00:00:00 2001 From: Erik Davis Date: Tue, 1 Oct 2024 09:28:42 -0700 Subject: [PATCH 2/3] bump version --- source/openpulse/openpulse/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/openpulse/openpulse/__init__.py b/source/openpulse/openpulse/__init__.py index 88a51a5..e8d3c1e 100644 --- a/source/openpulse/openpulse/__init__.py +++ b/source/openpulse/openpulse/__init__.py @@ -21,7 +21,7 @@ "parse", ] -__version__ = "1.0.0" +__version__ = "1.0.1" from . import ast, parser, spec from .parser import parse From 96a7f0fee005ff2f38f4f014bff9025f6fac62ef Mon Sep 17 00:00:00 2001 From: Erik Davis Date: Tue, 1 Oct 2024 09:32:45 -0700 Subject: [PATCH 3/3] use v4 upload/download actions --- .github/workflows/build-ast.yml | 4 ++-- .github/workflows/deploy-ast.yml | 6 +++--- .github/workflows/tests-ast.yml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-ast.yml b/.github/workflows/build-ast.yml index 8730b8b..1af92a2 100644 --- a/.github/workflows/build-ast.yml +++ b/.github/workflows/build-ast.yml @@ -75,13 +75,13 @@ jobs: - name: Build package run: python -m build --wheel --sdist . - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: openpulse-python-wheel path: ./source/openpulse/dist/*.whl if-no-files-found: error - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: openpulse-python-sdist path: ./source/openpulse/dist/*.tar.gz diff --git a/.github/workflows/deploy-ast.yml b/.github/workflows/deploy-ast.yml index f1ddd56..ab650a6 100644 --- a/.github/workflows/deploy-ast.yml +++ b/.github/workflows/deploy-ast.yml @@ -25,11 +25,11 @@ jobs: # The version checker uses 'importlib.metadata' which is Python 3.10+. python-version: '3.10' - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: openpulse-python-wheel - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: openpulse-python-sdist @@ -59,4 +59,4 @@ jobs: set -e source .venv/bin/activate python3 -mpip install -U twine - twine upload openpulse-*.whl openpulse-*.tar.gz \ No newline at end of file + twine upload openpulse-*.whl openpulse-*.tar.gz diff --git a/.github/workflows/tests-ast.yml b/.github/workflows/tests-ast.yml index 67c5878..1e32d66 100644 --- a/.github/workflows/tests-ast.yml +++ b/.github/workflows/tests-ast.yml @@ -29,7 +29,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: openpulse-python-wheel path: ./source/openpulse/