Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solve version discrepancy in release #142

Merged
merged 4 commits into from
Feb 20, 2025
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
2 changes: 2 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include README.md
recursive-include src/pyqasm *.py *.pyx
include src/pyqasm/py.typed
include src/pyqasm/py.typed

exclude tests/*
4 changes: 4 additions & 0 deletions bin/build_sdist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions bin/cibw/pre_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
22 changes: 22 additions & 0 deletions bin/test_sdist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,28 @@ SCRIPT_DIR="$TARGET_PATH/bin"

"$SCRIPT_DIR/install_wheel_extras.sh" "$TARGET_PATH/dist" --type sdist --extra cli --extra test

# 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"

Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "[email protected]"}]
readme = "README.md"
Expand Down Expand Up @@ -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]
Expand Down