feat: extend latest_release filter options - #188
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
strip_v=Falseto remove exactly one leading lowercasevfrom the latest release tag while leaving tags without that prefix, uppercaseV, and default-branch fallbacks unchangedreturn_sha=Falseto return the commit SHA represented by the selected release tag, including lightweight and nested annotated tagsBackward compatibility and option interaction
Both parameters are appended optional booleans, so existing one-argument Python and Jinja calls preserve the current tag/default-branch/
LATEST_RELEASE_ERRORbehavior. Whenreturn_sha=Trueandstrip_v=Trueare used together, SHA output takes precedence andstrip_vis intentionally a no-op.If latest-release selection fails, version mode retains the existing default-branch-name fallback; SHA mode resolves that branch head to a commit SHA. Once a release has been selected, tag-resolution failures return
LATEST_RELEASE_ERRORrather than silently returning an unrelated branch revision.Test coverage
Coverage includes:
v, repeatedv, no-prefix, and uppercaseVtagsreturn_shaprecedence when both options are enabledValidation
Passed:
.venv/bin/pytest -q— 239 passed in 28.84s.venv/bin/pre-commit run --all-files— YAML, EOF, and trailing-whitespace hooks passed.venv/bin/mkdocs build— documentation built successfully in 5.95s (existing link warnings remain).venv/bin/python -m compileall -q structkit tests— passedgit diff --check origin/main...HEAD— passedhttpdss/structkit— defaultv3.2.1, stripped3.2.1, SHA892c7aa8d35d44bf7ffbe41ab4367a0933bd6b05Additional repository-wide diagnostics expose existing baseline debt rather than regressions from this PR:
mkdocs build --strictaborts on the same 9 pre-existing broken-link warnings onorigin/mainmypy structkitfails on both this branch andorigin/mainat unchangedstructkit/commands/validate.py:99black --check/flake8are not currently clean onorigin/main; focused changed-file comparison introduces no new failures (andtests/test_filters_more.pyis now clean under both)