From 71b5d6f240be6db5aeb2afb185405029b76df279 Mon Sep 17 00:00:00 2001 From: TheGupta2012 Date: Tue, 25 Aug 2026 12:40:36 +0530 Subject: [PATCH] ci: normalize the stamped pre-release version to PEP 440 pre_build.sh wrote qbraid-core's spelling, 1.1.0-a.0, into pyproject.toml. setuptools normalized it to 1.1.0a0 for the package metadata, while _version.py kept the raw string, so pyqasm.__version__ disagreed with pip show and test_sdist.sh failed its version check. Co-Authored-By: Claude Opus 5 (1M context) --- CHANGELOG.md | 1 + bin/cibw/pre_build.sh | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 505a0976..33cea87b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ Types of changes: ### Dependencies ### Other +- Fixed the pre-release build stamping a version that `pyqasm.__version__` and the package metadata spelled differently. `pre_build.sh` wrote `1.1.0-a.0` into `pyproject.toml`, setuptools normalized that to `1.1.0a0` for the metadata, and `_version.py` kept the raw string, so `pip show pyqasm` and `pyqasm.__version__` disagreed and `test_sdist.sh` failed its version check. The stamped version is now normalized to PEP 440 before it is written. ([#414](https://github.com/qBraid/pyqasm/pull/414)) - Fixed the pre-release workflow publishing its source distribution under the released version instead of the pre-release one. `build_sdist.sh` ran `git reset --hard` and `git clean -xdf`, which discarded the `pyproject.toml` version that the preceding step had just stamped, so a run that built `1.1.0a0` wheels built a `1.1.0` sdist and PyPI rejected it as a duplicate. `pre_build.sh` already resets the tree, so the second reset is gone. It also no longer destroys uncommitted work when the script is run locally. ([#413](https://github.com/qBraid/pyqasm/pull/413)) - Added a `SECURITY.md` with a private vulnerability disclosure path. There was no documented way to report one, leaving a public issue or a guessed email address as the only options. Reports now go through this repository's GitHub security advisory form. ([#383](https://github.com/qBraid/pyqasm/pull/383)) diff --git a/bin/cibw/pre_build.sh b/bin/cibw/pre_build.sh index 19b4e6ad..aa6ee3cf 100755 --- a/bin/cibw/pre_build.sh +++ b/bin/cibw/pre_build.sh @@ -66,7 +66,10 @@ if [[ ${PRE_RELEASE_BUILD:-false} == "true" ]]; then # Get the path to .toml file PYPROJECT_TOML_PATH="${project}/pyproject.toml" - DEV_VERSION="${PRE_RELEASE_VERSION}" + + # Normalize to PEP 440, so that pyproject.toml, _version.py and the package + # metadata all spell the version the same way, eg 1.1.0-a.0 -> 1.1.0a0 + DEV_VERSION=$(python -c "from packaging.version import Version; print(Version('${PRE_RELEASE_VERSION}'))") # Update the version in the .toml file echo "Setting version to ${DEV_VERSION}"