From 8bbc6637fbc61477990b34605c25b3e9ed40cd0b Mon Sep 17 00:00:00 2001 From: TheGupta2012 Date: Wed, 19 Feb 2025 15:16:42 +0530 Subject: [PATCH 1/4] add git reset for clean checkout --- MANIFEST.in | 4 +++- bin/cibw/pre_build.sh | 4 ++++ pyproject.toml | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index d9b2a44d..5fcba451 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,5 @@ include README.md recursive-include src/pyqasm *.py *.pyx -include src/pyqasm/py.typed \ No newline at end of file +include src/pyqasm/py.typed + +exclude tests/* \ No newline at end of file diff --git a/bin/cibw/pre_build.sh b/bin/cibw/pre_build.sh index c48df491..c3a23b80 100755 --- a/bin/cibw/pre_build.sh +++ b/bin/cibw/pre_build.sh @@ -23,6 +23,10 @@ echo "Running pre_build.sh" # Script has an argument which is the project path project=$1 +# Reset any uncommitted changes which may have been made +git reset --hard HEAD +git clean -xdf + # Upgrade pip python -m pip install --upgrade pip diff --git a/pyproject.toml b/pyproject.toml index 4ea0a31a..aa77910d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,6 +45,7 @@ lint = ["black", "isort>=6.0.0", "pylint", "mypy", "qbraid-cli>=0.8.5"] docs = ["sphinx>=7.3.7,<8.2.0", "sphinx-autodoc-typehints>=1.24,<3.1", "sphinx-rtd-theme>=2.0.0,<4.0.0", "docutils<0.22", "sphinx-copybutton"] [tool.setuptools_scm] +version_scheme = "no-guess-dev" write_to = "src/pyqasm/_version.py" [tool.setuptools.package-data] From ebc4473d5c4e15c9cd5ceb0bfbb0a9c533a19cff Mon Sep 17 00:00:00 2001 From: TheGupta2012 Date: Wed, 19 Feb 2025 15:34:36 +0530 Subject: [PATCH 2/4] add reset to build sdist script --- bin/build_sdist.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/build_sdist.sh b/bin/build_sdist.sh index 62ab9497..dac5951f 100755 --- a/bin/build_sdist.sh +++ b/bin/build_sdist.sh @@ -19,6 +19,10 @@ set -x # current working directory TARGET_PATH="${1:-$(pwd)}" +# Reset the uncommitted changes which may have been made +git reset --hard HEAD +git clean -xdf + # 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) From 3b1550978202487a1801df35440e522e357b1f09 Mon Sep 17 00:00:00 2001 From: TheGupta2012 Date: Wed, 19 Feb 2025 15:44:57 +0530 Subject: [PATCH 3/4] add version print in build --- bin/test_sdist.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/test_sdist.sh b/bin/test_sdist.sh index 2666da04..0a06afe2 100755 --- a/bin/test_sdist.sh +++ b/bin/test_sdist.sh @@ -30,6 +30,9 @@ SCRIPT_DIR="$TARGET_PATH/bin" "$SCRIPT_DIR/install_wheel_extras.sh" "$TARGET_PATH/dist" --type sdist --extra cli --extra test +# Check the installed version +python -c "import pyqasm; print('Installed pyqasm version:', pyqasm.__version__)" + # Run the tests on the installed source distribution pytest "$TARGET_PATH/tests" From 54677f425691ec053e5df5440a53a17e9823e7b8 Mon Sep 17 00:00:00 2001 From: TheGupta2012 Date: Thu, 20 Feb 2025 11:45:26 +0530 Subject: [PATCH 4/4] add changes to release --- .github/workflows/pre-release.yml | 2 ++ .github/workflows/release.yml | 2 ++ bin/test_sdist.sh | 21 ++++++++++++++++++++- pyproject.toml | 2 +- 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 77cf4f1b..a3988e2c 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -129,6 +129,8 @@ jobs: run: bash bin/build_sdist.sh - name: Test source distribution + env: + RELEASE_BUILD: "true" run: bash bin/test_sdist.sh - name: Store artifacts diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 38ab2f97..15ecfd8b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -121,6 +121,8 @@ jobs: run: bash bin/build_sdist.sh - name: Test source distribution + env: + RELEASE_BUILD: "true" run: bash bin/test_sdist.sh - name: Store artifacts diff --git a/bin/test_sdist.sh b/bin/test_sdist.sh index 0a06afe2..6d804b6e 100755 --- a/bin/test_sdist.sh +++ b/bin/test_sdist.sh @@ -30,9 +30,28 @@ SCRIPT_DIR="$TARGET_PATH/bin" "$SCRIPT_DIR/install_wheel_extras.sh" "$TARGET_PATH/dist" --type sdist --extra cli --extra test -# Check the installed version +# Print the installed version python -c "import pyqasm; print('Installed pyqasm version:', pyqasm.__version__)" +# Verify the installed version if release build +if [[ ${RELEASE_BUILD:-false} == "true" ]]; then + echo "Testing release build version" + + # get version from importlib + IMPORTLIB_VERSION=$(python -c "import importlib.metadata; print(importlib.metadata.version('pyqasm'))") + echo "Importlib version: $IMPORTLIB_VERSION" + + # get version from __version__ + VERSION_ATTRIBUTE=$(python -c "import pyqasm; print(pyqasm.__version__)") + echo "Version attribute: $VERSION_ATTRIBUTE" + + # check if the versions are the same + if [[ $IMPORTLIB_VERSION != $VERSION_ATTRIBUTE ]]; then + echo "Versions do not match" + exit 1 + fi +fi + # Run the tests on the installed source distribution pytest "$TARGET_PATH/tests" diff --git a/pyproject.toml b/pyproject.toml index aa77910d..26dbd32f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "pyqasm" -version = "0.2.0" +version = "0.2.1-alpha" description = "Python toolkit providing an OpenQASM 3 semantic analyzer and utilities for program analysis and compilation." authors = [{name = "qBraid Development Team"}, {email = "contact@qbraid.com"}] readme = "README.md"