Skip to content

Commit

Permalink
Support type-hinted python version string
Browse files Browse the repository at this point in the history
  • Loading branch information
nwiltsie committed Oct 2, 2024
1 parent b5a2e22 commit 5269c31
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions bumpchanges/updatefiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
version # Literal `version`
(?:__)? # Optional literal `__`
(?P=vquote) # `'`, `"`, or nothing (back-reference to `vquote`)
(?:\s*:\s*str\b)? # Optional literal `: str` (for python typing)
(?:
\s* # Any whitespace
[=:]? # `=`, `:`, or nothing
Expand Down
5 changes: 5 additions & 0 deletions tests/test_versionfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
"""__version__ = 1.1.0""",
"""__version__ = 2.3.4""",
),
(
# Python-style with typing
"""__version__: str = '1.1.0'""",
"""__version__: str = '2.3.4'""",
),
(
# Plain string version
'''version = "1.1.0"''',
Expand Down

0 comments on commit 5269c31

Please sign in to comment.