From bf65034a1a9b8b23dbbd6a51f593c8e0c53754a9 Mon Sep 17 00:00:00 2001 From: arunjmoorthy Date: Mon, 26 May 2025 13:35:28 -0700 Subject: [PATCH 1/8] Fix #182: added pulse dependency/docs --- README.md | 8 ++++++++ pyproject.toml | 1 + 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index 4a47a245..17735776 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,14 @@ PyQASM requires Python 3.10 or greater, and can be installed with pip as follows pip install pyqasm ``` +### Optional Dependencies + +PyQASM provides an optional extra called pyqasm[pulse] that adds pulse/calibration features. + +```bash +pip install pyqasm[pulse] +``` + ### Install from source You can also install from source by cloning this repository and running a pip install command diff --git a/pyproject.toml b/pyproject.toml index f78becce..10a6f0b1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,6 +44,7 @@ test = ["pytest", "pytest-cov", "pytest-mpl", "matplotlib"] lint = ["black", "isort>=6.0.0", "pylint", "mypy", "qbraid-cli>=0.10.2"] docs = ["sphinx>=7.3.7,<8.3.0", "sphinx-autodoc-typehints>=1.24,<3.2", "sphinx-rtd-theme>=2.0.0,<4.0.0", "docutils<0.22", "sphinx-copybutton"] visualization = ["matplotlib"] +pulse = ["openpulse[parser]>=1.0.1"] [tool.setuptools.package-data] pyqasm = ["py.typed", "*.pyx"] From 94498560d2cc4c25a5c12fa0682c23b0cdb3ab47 Mon Sep 17 00:00:00 2001 From: arunjmoorthy Date: Wed, 28 May 2025 00:08:30 -0700 Subject: [PATCH 2/8] readme/test_import updated --- README.md | 12 ++++++++++++ tests/pulse/test_import.py | 8 ++++++++ 2 files changed, 20 insertions(+) create mode 100644 tests/pulse/test_import.py diff --git a/README.md b/README.md index 17735776..7baa7c70 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,18 @@ PyQASM provides an optional extra called pyqasm[pulse] that adds pulse/calibrati pip install pyqasm[pulse] ``` +PyQASM also offers optional extras for command-line interface (CLI) functionality and for program visualization. + +To install the CLI tools: +```bash +pip install pyqasm[cli] +``` + +To install the visualization tools: +```bash +pip install pyqasm[visualization] +``` + ### Install from source You can also install from source by cloning this repository and running a pip install command diff --git a/tests/pulse/test_import.py b/tests/pulse/test_import.py new file mode 100644 index 00000000..4fa9b371 --- /dev/null +++ b/tests/pulse/test_import.py @@ -0,0 +1,8 @@ +import pytest + +def test_openpulse_import(): + """Tests that openpulse can be imported.""" + try: + import openpulse + except ImportError: + pytest.fail("Failed to import openpulse. Ensure that pyqasm[pulse] is installed.") \ No newline at end of file From b56be8425a5b7c7ee623aa6046175f6fdbfb18ce Mon Sep 17 00:00:00 2001 From: arunjmoorthy Date: Wed, 28 May 2025 01:09:53 -0700 Subject: [PATCH 3/8] test_import updated --- tests/pulse/test_import.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/pulse/test_import.py b/tests/pulse/test_import.py index 4fa9b371..f981a990 100644 --- a/tests/pulse/test_import.py +++ b/tests/pulse/test_import.py @@ -1,8 +1,5 @@ import pytest def test_openpulse_import(): - """Tests that openpulse can be imported.""" - try: - import openpulse - except ImportError: - pytest.fail("Failed to import openpulse. Ensure that pyqasm[pulse] is installed.") \ No newline at end of file + """Tests that openpulse can be imported if pyqasm[pulse] is installed.""" + pytest.importorskip("openpulse") \ No newline at end of file From 551bd1d838c7007166df939ceeaa9cdf1eafa345 Mon Sep 17 00:00:00 2001 From: arunjmoorthy Date: Wed, 28 May 2025 01:22:13 -0700 Subject: [PATCH 4/8] fixed import order --- tests/pulse/test_import.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/pulse/test_import.py b/tests/pulse/test_import.py index f981a990..c1d2f3b6 100644 --- a/tests/pulse/test_import.py +++ b/tests/pulse/test_import.py @@ -1,5 +1,7 @@ +"""Tests for pulse functionality.""" import pytest + def test_openpulse_import(): """Tests that openpulse can be imported if pyqasm[pulse] is installed.""" - pytest.importorskip("openpulse") \ No newline at end of file + pytest.importorskip("openpulse") From f8ef8fb258c4214cb2434d57f1c914ea5ccc0b66 Mon Sep 17 00:00:00 2001 From: arunjmoorthy Date: Wed, 28 May 2025 01:25:35 -0700 Subject: [PATCH 5/8] fixed black formatting --- tests/pulse/test_import.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/pulse/test_import.py b/tests/pulse/test_import.py index c1d2f3b6..29b5ed20 100644 --- a/tests/pulse/test_import.py +++ b/tests/pulse/test_import.py @@ -1,4 +1,5 @@ """Tests for pulse functionality.""" + import pytest From 800251c54e8eb5a426962b15dce0de1a3a1c4cd7 Mon Sep 17 00:00:00 2001 From: arunjmoorthy Date: Wed, 28 May 2025 01:30:33 -0700 Subject: [PATCH 6/8] added license header --- tests/pulse/test_import.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/pulse/test_import.py b/tests/pulse/test_import.py index 29b5ed20..f7e6abb1 100644 --- a/tests/pulse/test_import.py +++ b/tests/pulse/test_import.py @@ -1,3 +1,17 @@ +# Copyright 2025 qBraid +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + """Tests for pulse functionality.""" import pytest From 70547b71ea8ad4ddc5523bfafbe02e991a8d0f4f Mon Sep 17 00:00:00 2001 From: TheGupta2012 Date: Wed, 28 May 2025 15:55:18 +0530 Subject: [PATCH 7/8] updating extras in ci --- .github/workflows/main.yml | 2 +- tox.ini | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dfaa890c..56a3f401 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -102,7 +102,7 @@ jobs: CIBW_ARCHS_LINUX: x86_64 CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }} CIBW_BEFORE_BUILD: bash {project}/bin/cibw/pre_build.sh {project} - CIBW_TEST_EXTRAS: "test,cli" + CIBW_TEST_EXTRAS: "test,cli,pulse" CIBW_TEST_COMMAND: bash {project}/bin/cibw/test_wheel.sh {project} CIBW_BUILD_VERBOSITY: 1 diff --git a/tox.ini b/tox.ini index d956aa78..9c488a8a 100644 --- a/tox.ini +++ b/tox.ini @@ -16,6 +16,7 @@ description = Run pytests and generate coverage report. extras = test cli + pulse commands = pytest tests --cov=pyqasm --cov-config=pyproject.toml --cov-report=term --cov-report=xml {posargs} From 1ea2418187a1ebd8ae49475e6f067a258546a1e8 Mon Sep 17 00:00:00 2001 From: TheGupta2012 Date: Wed, 28 May 2025 15:59:32 +0530 Subject: [PATCH 8/8] update changelog [no ci] --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ad42334..369f94ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ Types of changes: ## Unreleased ### Added +- Added the `pulse` extra dependency to the `pyproject.toml` file, which includes the `openpulse` package. This allows users to install pulse-related functionality when needed. ([#195](https://github.com/qBraid/pyqasm/pull/195)) ### Improved / Modified