Skip to content

Commit 9c1e5dc

Browse files
committed
Version-reading: get from importlib
1 parent 2c2a655 commit 9c1e5dc

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

modepy/version.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
VERSION = (2024, 1)
2-
VERSION_TEXT = ".".join(str(i) for i in VERSION)
1+
import re
2+
from importlib import metadata
3+
4+
5+
VERSION_TEXT = metadata.version("modepy")
6+
_match = re.match("^([0-9.]+)([a-z0-9]*?)$", VERSION_TEXT)
7+
assert _match is not None
8+
VERSION_STATUS = _match.group(2)
9+
VERSION = tuple(int(nr) for nr in _match.group(1).split("."))

0 commit comments

Comments
 (0)