Skip to content

Commit

Permalink
Version-reading: get from importlib
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Jul 3, 2024
1 parent 2c2a655 commit 9c1e5dc
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions modepy/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
VERSION = (2024, 1)
VERSION_TEXT = ".".join(str(i) for i in VERSION)
import re
from importlib import metadata


VERSION_TEXT = metadata.version("modepy")
_match = re.match("^([0-9.]+)([a-z0-9]*?)$", VERSION_TEXT)
assert _match is not None
VERSION_STATUS = _match.group(2)
VERSION = tuple(int(nr) for nr in _match.group(1).split("."))

0 comments on commit 9c1e5dc

Please sign in to comment.