Skip to content

Add version normalization and configurable suffix rendering - #78

Merged
helly25 merged 1 commit into
mainfrom
feat/version-normalize
Oct 18, 2026
Merged

helly25 merged 1 commit into
mainfrom
feat/version-normalize

Conversation

@helly25

@helly25 helly25 commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

Add versions.normalize_tuple and versions.normalize_string for collecting interleaved version suffixes and rendering them with configurable separators. Shared-prefix rendering preserves original encounter order: 123+a.b-c.d+e.f-g.h becomes 123#a.b.c.d.e.f.g.h with prefix="#".

AG;DR

  • Both functions accept strings or component lists/tuples and share grouping logic. Strings tokenize on ., -, and +; sequences preserve existing component boundaries, spelling, and types.
  • Default output groups release, -, then +, preserving encounter order within each group. String rendering accepts a literal separator, None for group markers, or a dict specifying distinct -/+ separators.
  • A string prefix merges suffix groups before reordering. A separator dict combined with a shared prefix fails as ambiguous. Release components always render with dots.
  • These are mode-independent structural operations, also exposed by with_mode APIs. They do not change parsing or claim standards validation; docs distinguish string tokenization from parsed identifier boundaries and explain empty/malformed input, custom output, and spelling preservation.
  • Add regression tests for all discussed examples, sequence/string equivalence, ordering, custom separators and prefixes, invalid inputs, and non-mutation. Keep table columns and inline example comments aligned.
  • Validation: all 182 Bazel tests, all 46 Python tests, and focused pre-commit pass. The pushed-head Bazel suite and all six CI checks pass, including Linux, macOS, and Windows.
  • Consumer: Cleanup of expression-based version selectors with explicit prerelease control bazel-contrib/toolchains_llvm#911 now replaces _version_string with normalize_string and temporarily pins this PR's source. Its 43 Bzlmod tests, 41 WORKSPACE tests, Trunk checks, and three integration-module graphs pass. Merge this bzl change and publish 0.8.0 before removing the consumer overrides. The bzl release remains on hold.

Signed-off-by: helly25 <6420169+helly25@users.noreply.github.com>
@helly25
helly25 requested a review from Fab-Cat as a code owner October 18, 2026 13:56
@helly25
helly25 merged commit 818b24f into main Oct 18, 2026
6 checks passed
@helly25
helly25 deleted the feat/version-normalize branch October 18, 2026 14:02
@helly25 helly25 mentioned this pull request Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant