feat(config): support Python type-annotated version variables - #1485
Merged
Merged
Conversation
Copilot
AI
changed the title
[WIP] Fix version variable detection for type annotated Python files
feat(config): support Python type-annotated version variables
Aug 29, 2026
codejedi365
force-pushed
the
copilot/fix-version-variable-detection
branch
from
August 29, 2026 18:52
0f4aea5 to
b41666e
Compare
codejedi365
marked this pull request as ready for review
August 29, 2026 18:53
codejedi365
marked this pull request as draft
August 29, 2026 18:53
codejedi365
force-pushed
the
copilot/fix-version-variable-detection
branch
from
August 29, 2026 18:59
b41666e to
01c8ce3
Compare
codejedi365
marked this pull request as ready for review
August 29, 2026 19:00
… variable Signed-off-by: codejedi365 <codejedi365@users.noreply.github.com>
…on variables Implements: #1443 Signed-off-by: codejedi365 <codejedi365@users.noreply.github.com>
…sion_variables` Co-authored-by: codejedi365 <17354856+codejedi365@users.noreply.github.com> Signed-off-by: codejedi365 <codejedi365@users.noreply.github.com>
codejedi365
force-pushed
the
copilot/fix-version-variable-detection
branch
from
August 29, 2026 19:17
4326a6f to
f1a3d08
Compare
codejedi365
approved these changes
Aug 29, 2026
codejedi365
left a comment
Contributor
There was a problem hiding this comment.
@copilot, can you make sure that the documentation is up to date to match this
Contributor
🎉 This PR has been published as part of v10.7.0 🎉You can find more information about this release on the GitHub Releases page. |
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.
Version variables with PEP 526 type annotations (e.g.,
__version__: str = "1.0.0") were silently skipped during version stamping because the pattern regex had no support for the: <type>segment between variable name and assignment operator.Changes
src/semantic_release/version/declarations/pattern.py: Insert an optional non-capturing regex group(?:\s*:\s*[^\s=:][^=:=]*)?between the variable name and assignment operator infrom_string_definition. The character class[^\s=:]as the first character after the colon prevents matching:=(walrus) or::, preserving all existing operator handling.tests/unit/semantic_release/version/declarations/test_pattern_declaration.py: Add four parametrized cases coveringstr,Optional[str],typing.Final[str]annotations, and tag-format with annotation.Example
Fixes #1443