Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
run: |
BUMP_TYPE=${{ github.event.inputs.bump_type }}
VERSION=$(python3 bin/bump_version.py pyqasm $BUMP_TYPE)
python3 bin/update_citation.py $VERSION
echo "version=$VERSION" >> $GITHUB_OUTPUT
git commit -am "Bump $BUMP_TYPE version to $VERSION"
git push origin qbraid-bot/${{ github.run_id }}
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:

jobs:
build_wheels:
if: github.event.pull_request.draft == false
runs-on: ${{ matrix.os }}
strategy:

Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:

# Ensure that a wheel builder finishes even if another fails
fail-fast: false
fail-fast: true

matrix:
include:
Expand Down Expand Up @@ -83,9 +83,6 @@ jobs:
with:
python-version: "3.11"

- name: Write version file
run: python bin/write_version_file.py

- name: Build and Test Wheels
env:
CIBW_BUILD: "cp${{ matrix.python }}-${{ matrix.platform_id }}"
Expand Down Expand Up @@ -117,9 +114,6 @@ jobs:
with:
python-version: "3.11"

- name: Write version file
run: python bin/write_version_file.py

- name: Build source distribution
run: bash bin/build_sdist.sh

Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Types of changes:

### Added
- Added support for standalone measurements that do not store the result in a classical register ([#141](https://github.com/qBraid/pyqasm/pull/141)).
- Added logic to `bump-version.yml` workflow that automatically updates `CITATION.cff` upon new release ([#147](https://github.com/qBraid/pyqasm/pull/147))

### Improved / Modified
- Re-wrote the `QasmAnalyzer.extract_qasm_version` method so that it extracts the program version just by looking at the [first non-comment line](https://github.com/openqasm/openqasm/blob/bb923eb9a84fdffe1ba6fc3c20d0b47a131523d9/source/language/comments.rst#version-string), instead of parsing the entire program ([#140](https://github.com/qBraid/pyqasm/pull/140)).
Expand All @@ -25,13 +26,15 @@ Types of changes:
### Removed

### Fixed
- Fixed bug in release workflow(s) that caused discrepancy between `pyqasm.__version__` and `importlib.metadata.version` ([#147](https://github.com/qBraid/pyqasm/pull/147))

### Dependencies

## Past Release Notes

Archive of changelog entries from previous releases:

- [v0.2.1](https://github.com/qBraid/pyqasm/releases/tag/v0.2.1)
- [v0.2.0](https://github.com/qBraid/pyqasm/releases/tag/v0.2.0)
- [v0.1.0](https://github.com/qBraid/pyqasm/releases/tag/v0.1.0)
- [v0.1.0-alpha](https://github.com/qBraid/pyqasm/releases/tag/v0.1.0-alpha)
Expand Down
39 changes: 18 additions & 21 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
cff-version: 1.2.0
title: >-
PyQASM: Python toolkit for OpenQASM program analysis and compilation.
message: >-
If you use this software, please cite it using the
metadata from this file.
title: 'PyQASM: Python toolkit for OpenQASM program analysis and compilation.'
message: If you use this software, please cite it using the metadata from this file.
type: software
authors:
- given-names: Harshit
family-names: Gupta
affiliation: qBraid Co.
- given-names: Ryan James
family-names: Hill
affiliation: qBraid Co.
orcid: https://orcid.org/0009-0006-9222-0810
repository-code: 'https://github.com/qBraid/pyqasm'
url: 'https://sdk.qbraid.com/projects/pyqasm/en/stable/'
repository-artifact: 'https://github.com/qBraid/pyqasm/releases/tag/v0.1.0'
- given-names: Harshit
family-names: Gupta
affiliation: qBraid Co.
- given-names: Ryan James
family-names: Hill
affiliation: qBraid Co.
orcid: https://orcid.org/0009-0006-9222-0810
repository-code: https://github.com/qBraid/pyqasm
url: https://sdk.qbraid.com/projects/pyqasm/en/stable/
repository-artifact: https://github.com/qBraid/pyqasm/releases/tag/v0.2.1
keywords:
- python
- quantum-computing
- openqasm
- qbraid
- python
- quantum-computing
- openqasm
- qbraid
license: GPL-3.0
version: 0.1.0
date-released: '2024-12-10'
version: 0.2.1
date-released: '2025-02-20'
9 changes: 7 additions & 2 deletions bin/build_sdist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,20 @@ TARGET_PATH="${1:-$(pwd)}"
git reset --hard HEAD
git clean -xdf

PROJECT_ROOT=$(git rev-parse --show-toplevel)

# Create a temporary dir, XXXXX will be replaced by a random string
# of 5 chars to make the directory unique
TEMP_ENV_DIR=$(mktemp -d -t build_env_XXXXX)
python -m venv "$TEMP_ENV_DIR"
source "$TEMP_ENV_DIR/bin/activate"

# Install the necessary packages for building sdist
# Install the necessary packages for building sdist
# NOTE: project deps are not reqd as we are just making a source distribution
python -m pip install twine build
python -m pip install --upgrade pip
python -m pip install twine build tomli

python $PROJECT_ROOT/bin/write_version_file.py

python -m build --sdist --outdir "$TARGET_PATH/dist" "$TARGET_PATH"

Expand Down
5 changes: 3 additions & 2 deletions bin/cibw/pre_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ git clean -xdf
python -m pip install --upgrade pip

# Install required packages
pip install setuptools wheel cython
pip install setuptools wheel cython tomli

# Test if we are running the build for pre-release version
# Test if we are running the build for pre-release version
if [[ ${PRE_RELEASE_BUILD:-false} == "true" ]]; then
echo "Running pre-release changes"

Expand Down Expand Up @@ -70,5 +70,6 @@ if [[ ${PRE_RELEASE_BUILD:-false} == "true" ]]; then

fi

python $project/bin/write_version_file.py

echo "Finished running pre_build.sh"
2 changes: 2 additions & 0 deletions bin/create_dev_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ if ! python -c "import build" 2>/dev/null; then
exit 1
fi

python $REPO_DIR/bin/write_version_file.py

# Build the project
echo "Building the project..."
python -m build --outdir "${OUT_DIR}"
Expand Down
48 changes: 48 additions & 0 deletions bin/update_citation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright (C) 2025 qBraid
#
# This file is part of PyQASM
#
# PyQASM is free software released under the GNU General Public License v3
# or later. You can redistribute and/or modify it under the terms of the GPL v3.
# See the LICENSE file in the project root or <https://www.gnu.org/licenses/gpl-3.0.html>.
#
# THERE IS NO WARRANTY for PyQASM, as per Section 15 of the GPL v3.

"""
Update the CITATION.cff file with the new version and release date.
"""

import pathlib
import sys
from datetime import date

import yaml


def update_citation_cff(version: str) -> None:
"""Update the CITATION.cff file with the new version and release date."""
root = pathlib.Path(__file__).parent.parent.resolve()
citation_file = root / "CITATION.cff"

with open(citation_file, "r", encoding="utf-8") as file:
data = yaml.safe_load(file)

data["version"] = version
data["repository-artifact"] = f"https://github.com/qBraid/pyqasm/releases/tag/v{version}"

today = date.today()
data["date-released"] = today.strftime("%Y-%m-%d")

with open(citation_file, "w", encoding="utf-8") as file:
yaml.dump(data, file, sort_keys=False)

print(f"CITATION.cff updated with version {version} and release date {today}")


if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python update_citation.py <new_version>")
sys.exit(1)

new_version = sys.argv[1]
update_citation_cff(new_version)
6 changes: 5 additions & 1 deletion bin/write_version_file.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@

import pathlib
import sys
import tomllib

if sys.version_info >= (3, 11):
import tomllib
else:
import tomli as tomllib


def get_version_from_pyproject(pyproject_path: pathlib.Path) -> str:
Expand Down