ci: fix pre-release versioning issues - #414
Conversation
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) <noreply@anthropic.com>
Argus reviewAuto-review is off for this repo. Tick the box below to run a review on this PR.
Estimated cost
Tip: you can also comment |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Pre-release job for sdist worked, merging |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The pre-release run failed its source distribution test:
Failing run: https://github.com/qBraid/pyqasm/actions/runs/32819763552/job/97715243458
One version, two spellings.
pre_build.shstamped qbraid-core's1.1.0-a.0intopyproject.toml. setuptools normalized that to1.1.0a0for the packagemetadata, while
write_version_file.pycopied the raw string into_version.py.So
importlib.metadata.versionandpyqasm.__version__disagreed, and theRELEASE_BUILDcheck intest_sdist.shcompares them as plain strings.The check was right to fail. On every pre-release,
pip show pyqasmreported1.1.0a0whilepyqasm.__version__reported1.1.0-a.0. #413 is what exposedit: before that, the reset in
build_sdist.shdiscarded the stamp, so both sidesread the plain release version and the check never saw a pre-release.
This normalizes the stamped version to PEP 440 before writing it, so
pyproject.toml,_version.pyand the package metadata all agree.packagingis available at that point, becausepre_build.shinstallsqbraid-corein the same block andqbraid-corerequires it.Verified locally
Ran the full sequence in a throwaway clone with its own venv:
Not addressed here
__version_tuple__is still approximate:parse_version_tuple("1.1.0a0")yields
(1, 1, '0a0'). That is better than the(1, 1, '0-a', '0')it producedbefore, but it is not a real PEP 440 parse.
[project] versionis still1.1.0, so thestamper keeps returning
1.1.0a0, and those wheels are already on PyPI. Thepublish step will keep failing with
400 File already existsuntil the baseversion moves to the next unreleased one, spelled with an
-alphasuffix sothat repeat pre-releases bump to a1, a2 and so on.