From ea79ee33e9c83b26a3d1ef22714ca513d2347417 Mon Sep 17 00:00:00 2001 From: lachlangrose Date: Mon, 5 Oct 2026 15:58:09 -0300 Subject: [PATCH] fix: stop root releases from changing package versions and tag single-package release PRs - The root package (path ".") python strategy changes the version string in every version.py file in the repository. The 1.8.2 and 1.8.3 releases wrote the LoopStructural version into the map2loop and loopstructural_visualisation version.py files, and loopstructuralvisualisation was published as 1.8.2. The version.py files now read the version from the package metadata, and loopstructural_visualisation sets its version (0.2.0) in pyproject.toml. - With one combined release PR, a PR that holds only the root package is not tagged ("PR component: undefined does not match configured component"), which blocked all later releases. Use separate release PRs for each package. - The root path outputs of release-please-action have no "--" prefix, so LoopStructural--release_created was never set and the conda and documentation builds did not start. --- .github/workflows/release-please.yml | 5 +++-- .release-please-config.json | 1 + packages/loopstructural_visualisation/pyproject.toml | 5 +---- .../src/loopstructuralvisualisation/version.py | 11 ++++++++++- packages/map2loop/src/map2loop/version.py | 11 ++++++++++- 5 files changed, 25 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index c41092e37..b24e8e91a 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -28,8 +28,9 @@ jobs: release_created: ${{ steps.release.outputs.releases_created }} # true only when the LoopStructural component itself released -- # gates conda/docs builds, which are LoopStructural-specific and - # shouldn't re-run for a workspace-package-only release. - loopstructural_release_created: ${{ steps.release.outputs['LoopStructural--release_created'] }} + # shouldn't re-run for a workspace-package-only release. The root path + # (".") outputs have no "--" prefix. + loopstructural_release_created: ${{ steps.release.outputs.release_created }} package: needs: release-please if: ${{ needs.release-please.outputs.release_created == 'true'}} diff --git a/.release-please-config.json b/.release-please-config.json index 714ef09aa..b1fd96294 100644 --- a/.release-please-config.json +++ b/.release-please-config.json @@ -1,4 +1,5 @@ { + "separate-pull-requests": true, "packages": { ".": { "release-type": "python", diff --git a/packages/loopstructural_visualisation/pyproject.toml b/packages/loopstructural_visualisation/pyproject.toml index 933c7ad5f..f037e1324 100644 --- a/packages/loopstructural_visualisation/pyproject.toml +++ b/packages/loopstructural_visualisation/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "loopstructuralvisualisation" description = "3D geological modelling visualisation for LoopStructural" -dynamic = ["version"] +version = "0.2.0" requires-python = ">=3.9" authors = [{ name = "Lachlan Grose", email = "lachlan.grose@monash.edu" }] readme = "README.md" @@ -42,9 +42,6 @@ Documentation = "https://Loop3d.org/LoopStructural/" "Bug Tracker" = "https://github.com/loop3d/loopstructural-visualisation/issues" "Source Code" = "https://github.com/loop3d/loopstructural-visualisation" -[tool.setuptools.dynamic] -version = { attr = "loopstructuralvisualisation.version.__version__" } - [tool.setuptools.packages.find] where = ["src"] include = ["loopstructuralvisualisation", "loopstructuralvisualisation.*"] diff --git a/packages/loopstructural_visualisation/src/loopstructuralvisualisation/version.py b/packages/loopstructural_visualisation/src/loopstructuralvisualisation/version.py index a44132de1..81a917bba 100644 --- a/packages/loopstructural_visualisation/src/loopstructuralvisualisation/version.py +++ b/packages/loopstructural_visualisation/src/loopstructuralvisualisation/version.py @@ -1 +1,10 @@ -__version__ = "1.8.3" +# The version is set in pyproject.toml. Do not write a version string here: +# release-please changes each "__version__ = ..." string in every version.py +# file in the repository to the version of the release it makes. +from importlib.metadata import PackageNotFoundError, version + +try: + __version__ = version("loopstructuralvisualisation") +except PackageNotFoundError: + # the package is imported from source and is not installed + __version__ = "unknown" diff --git a/packages/map2loop/src/map2loop/version.py b/packages/map2loop/src/map2loop/version.py index a44132de1..076fb5aac 100644 --- a/packages/map2loop/src/map2loop/version.py +++ b/packages/map2loop/src/map2loop/version.py @@ -1 +1,10 @@ -__version__ = "1.8.3" +# The version is set in pyproject.toml. Do not write a version string here: +# release-please changes each "__version__ = ..." string in every version.py +# file in the repository to the version of the release it makes. +from importlib.metadata import PackageNotFoundError, version + +try: + __version__ = version("map2loop") +except PackageNotFoundError: + # the package is imported from source and is not installed + __version__ = "unknown"