Closed
Labels
Description
Description
Python-semantic-release does not detect and update version variables in Python files when they include type annotations (type hints).
Version
- python-semantic-release: 10.5.3
Desired workflow
- Create a Python file with a version variable that includes a type hint:
# src/my_package/__init__.py
__version__: str = "1.6.0"- Configure
version_variablesinpyproject.toml:
[tool.semantic_release]
version_variables = [
"src/my_package/__init__.py:__version__",
]- Run
semantic-release version
Desired behavior
The __version__ variable should be updated to the new version (e.g., "1.7.0")
Current behavior
The __version__ variable is NOT updated. Only version_toml entries are updated.
Workaround
Remove the type hint from the version variable:
__version__ = "1.6.0" # without type hint
Activity
codejedi365 commentedon Apr 22, 2026
Changing to a feature request as version with a type annotation behavior was not a considered use (not documented example or tested by maintainers).
[-]version_variables configuration fails to update Python variables with type hints[/-][+]feat: extend `version_variables` to replace vars with annotations[/+]github-actions commentedon Jul 22, 2026
It has been 90 days since the last update on this confirmed issue. @python-semantic-release/team can you provide an update on the status of this issue?
feat(config): support Python type-annotated version variables (fixes #…
feat(cmd-stamp): expand version stamp mechanism to support typed pyth…
feat(cmd-stamp): expand version stamp mechanism to support typed pyth…
feat(cmd-stamp): expand version stamp mechanism to support typed pyth…
codejedi365 commentedon Sep 22, 2026
🎉 This issue has been resolved in v10.7.0 🎉
You can find more information about this release on the GitHub Releases page.
If your issue persists, please reply here and we will re-open the issue. If you receive a new error, please open a new issue and reference this issue there.