ENH: YYYYMMDD tweak version for between-tag gating (supersedes #6665)#6667
ENH: YYYYMMDD tweak version for between-tag gating (supersedes #6665)#6667hjmjohnson wants to merge 1 commit into
Conversation
Set the fourth (tweak) version component to the UTC date of the most recent migration-inducing change and export ITK_VERSION_TWEAK and ITK_VERSION_FULL through ITKConfig.cmake. Downstream projects building against untagged commits (e.g. during git bisect) can gate at configure time with ITK_VERSION_FULL VERSION_GREATER_EQUAL M.m.p.YYYYMMDD; version ordering expires the value at each release tag with no extra checklist steps. Policy, recorded in AGENTS.md and the migration-guide index: a change requiring a migration-guide entry or altering public API must bump ITK_VERSION_TWEAK; other key changes may. EXACT find_package matches on the three-component version are preserved.
|
| Filename | Overview |
|---|---|
| AGENTS.md | Adds the repository policy that migration-guide or public API changes must bump ITK_VERSION_TWEAK; no issues found. |
| CMake/ITKConfig.cmake.in | Exports ITK_VERSION_TWEAK and ITK_VERSION_FULL through ITKConfig.cmake; no issues found. |
| CMake/ITKConfigVersion.cmake.in | Extends PACKAGE_VERSION to four components while preserving exact matching for three-component version requests; no issues found. |
| CMake/itkVersion.cmake | Introduces the date-based tweak version component initialized to 20260715; no issues found. |
| CMakeLists.txt | Uses the full four-component version for the CMake project while retaining the three-component ITK_VERSION; no issues found. |
| Documentation/AI/git-commits.md | Documents the required tweak-version bump policy for migration and API changes; no issues found. |
| Documentation/docs/migration_guides/index.md | Documents downstream configure-time gating with ITK_VERSION_FULL; no issues found. |
| Utilities/Maintenance/BumpVersionTweak.py | Adds a helper to update ITK_VERSION_TWEAK, but the default UTC expression breaks on Python 3.10. |
Sequence Diagram
%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Dev as Developer
participant Script as BumpVersionTweak.py
participant Version as CMake/itkVersion.cmake
participant Build as CMake project()
participant Config as ITKConfig.cmake
participant Downstream as Downstream CMake
Dev->>Script: run with YYYYMMDD or default UTC date
Script->>Version: update ITK_VERSION_TWEAK if date is not older
Build->>Version: include(itkVersion)
Build->>Build: project(ITK VERSION major.minor.patch.tweak)
Build->>Config: configure ITK_VERSION_TWEAK and ITK_VERSION_FULL
Downstream->>Config: find_package(ITK REQUIRED)
Downstream->>Downstream: compare ITK_VERSION_FULL for between-tag gating
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Dev as Developer
participant Script as BumpVersionTweak.py
participant Version as CMake/itkVersion.cmake
participant Build as CMake project()
participant Config as ITKConfig.cmake
participant Downstream as Downstream CMake
Dev->>Script: run with YYYYMMDD or default UTC date
Script->>Version: update ITK_VERSION_TWEAK if date is not older
Build->>Version: include(itkVersion)
Build->>Build: project(ITK VERSION major.minor.patch.tweak)
Build->>Config: configure ITK_VERSION_TWEAK and ITK_VERSION_FULL
Downstream->>Config: find_package(ITK REQUIRED)
Downstream->>Downstream: compare ITK_VERSION_FULL for between-tag gating
Reviews (1): Last reviewed commit: "ENH: Add YYYYMMDD tweak version for betw..." | Re-trigger Greptile
| parser.add_argument( | ||
| "date", | ||
| nargs="?", | ||
| default=datetime.datetime.now(datetime.UTC).strftime("%Y%m%d"), |
There was a problem hiding this comment.
Use supported UTC constant
datetime.UTC was added in Python 3.11, while ITK 6 documentation still states Python 3.10+ support for wrapping. On Python 3.10 this default argument is evaluated while building the parser, so running BumpVersionTweak.py without an explicit date raises AttributeError before it can bump the version; datetime.timezone.utc works across the supported range.
Context Used: AGENTS.md (source)
Artifacts
Repro: interpreter availability check showing python3.10 unavailable and python3 version
- Keeps the command output available without making the summary code-heavy.
Repro: Python 3.10 datetime.UTC absence simulation harness
- Contains supporting evidence from the run (text/x-python; charset=utf-8).
Stack trace captured during the T-Rex run
- Keeps the raw stack trace available without making the summary code-heavy.
There was a problem hiding this comment.
Only python 3.11+ are supported.
Supersedes #6665 with the simpler design from its review discussion: the fourth (tweak) version component carries the
YYYYMMDD(UTC) date of the most recent migration-inducing change, exported asITK_VERSION_TWEAK/ITK_VERSION_FULLviaITKConfig.cmake, so downstream projects can gate at configure time between release tags — including duringgit bisecton untagged commits.Policy (documented in
AGENTS.md,Documentation/AI/git-commits.md, and the migration-guide index): a change requiring a migration-guide entry or altering public API must bumpITK_VERSION_TWEAK; other key changes may. The value is never reset — release-tag version ordering expires it naturally, so no release-checklist steps are added.Design notes vs #6665
ITK_VERSION_FULLunset → comparison false → legacy branch).Utilities/Maintenance/BumpVersionTweak.py: sets the tweak to today's UTC date or a given date, refuses to move it backwards, idempotent.itkConfigure.h'sITK_VERSION_STRINGis major.minor only, so the tweak never reaches compiled headers.ITKConfigVersion.cmake.ingains the tweak inPACKAGE_VERSION;find_package(ITK 6.0.0 EXACT)still matches via an explicit three-component equality arm.20260715= date of the latest migration-guide change onmain(fb2117c).Verification
project(VERSION)withitkVersion.cmakeincluded:PROJECT_VERSION=6.0.0.20260715,VERSION_GREATER_EQUALgates true/false correctly on either side of the date.BumpVersionTweak.pyexercised: forward bump, backward-date rejection (exit 1), same-date no-op.pre-commit run --all-filesclean.