Skip to content

Commit 02c9e6e

Browse files
authored
Merge pull request #328 from zivid/MISC-2025-07-03-drop-local-version-on-master
Do not add local version on master branch
2 parents 8f74152 + 1f7539f commit 02c9e6e

3 files changed

Lines changed: 20 additions & 15 deletions

File tree

continuous-integration/deployment/check_expected_artifacts.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ def _expected_artifacts(repository, commit_hash, ref):
1313
version = version_file.read_text().strip()
1414
if repository != ZIVID_PYTHON or ref != MASTER_REF:
1515
# On all branches but master in the zivid/zivid-python repo, a .dev0 suffix will be added to the version.
16-
version += ".dev0"
17-
return [artifact.format(version=version, commit_hash=commit_hash[:8]) for artifact in artifacts]
16+
version += ".dev0" + f"+{commit_hash[:8]}"
17+
18+
return [artifact.format(version=version) for artifact in artifacts]
1819

1920

2021
def _present_artifacts():
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
zivid-{version}+{commit_hash}-cp37-cp37m-win_amd64.whl
2-
zivid-{version}+{commit_hash}-cp38-cp38-win_amd64.whl
3-
zivid-{version}+{commit_hash}-cp39-cp39-win_amd64.whl
4-
zivid-{version}+{commit_hash}-cp310-cp310-win_amd64.whl
5-
zivid-{version}+{commit_hash}-cp311-cp311-win_amd64.whl
6-
zivid-{version}+{commit_hash}-cp312-cp312-win_amd64.whl
7-
zivid-{version}+{commit_hash}-cp313-cp313-win_amd64.whl
8-
zivid-{version}+{commit_hash}.tar.gz
1+
zivid-{version}-cp37-cp37m-win_amd64.whl
2+
zivid-{version}-cp38-cp38-win_amd64.whl
3+
zivid-{version}-cp39-cp39-win_amd64.whl
4+
zivid-{version}-cp310-cp310-win_amd64.whl
5+
zivid-{version}-cp311-cp311-win_amd64.whl
6+
zivid-{version}-cp312-cp312-win_amd64.whl
7+
zivid-{version}-cp313-cp313-win_amd64.whl
8+
zivid-{version}.tar.gz

setup.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ def _determine_package_version():
3131
github_repository = os.getenv("GITHUB_REPOSITORY")
3232
github_ref = os.getenv("GITHUB_REF")
3333

34-
if github_repository != "zivid/zivid-python" or github_ref != "refs/heads/master":
35-
# Only the master branch of the zivid-python repository is considered stable.
36-
version_segments.append("dev0")
37-
3834
local_version_segments = []
3935

4036
if sdk_version.get("pre_release"):
@@ -50,7 +46,15 @@ def _determine_package_version():
5046
else:
5147
local_version_segments.append("unofficial")
5248

53-
version = ".".join(version_segments) + "+" + ".".join(local_version_segments)
49+
if github_repository != "zivid/zivid-python" or github_ref != "refs/heads/master":
50+
# Only the master branch of the zivid-python repository is considered stable.
51+
# Anywhere else the version will be a development version, and we add the local version.
52+
version_segments.append("dev0")
53+
version = ".".join(version_segments) + "+" + ".".join(local_version_segments)
54+
else:
55+
# Stable releases must not include a local version to be allowed to upload to PyPI.
56+
version = ".".join(version_segments)
57+
5458

5559
return canonicalize_version(version, strip_trailing_zero=False)
5660

0 commit comments

Comments
 (0)