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/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 diff --git a/README.md b/README.md index 4a47a245..7baa7c70 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,26 @@ 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] +``` + +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/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"] diff --git a/tests/pulse/test_import.py b/tests/pulse/test_import.py new file mode 100644 index 00000000..f7e6abb1 --- /dev/null +++ b/tests/pulse/test_import.py @@ -0,0 +1,22 @@ +# 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 + + +def test_openpulse_import(): + """Tests that openpulse can be imported if pyqasm[pulse] is installed.""" + pytest.importorskip("openpulse") 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}