lektor_ng.version

src/lektor_ng/version.py
1
2
3
4
5
6
7
8
9
10
11
12
import tomllib
from pathlib import Path

__version__ = "@version@"
__hash__ = "@sha@"


def get_version() -> str:
    if __version__ == "@version@":
        path = Path(__file__).parent.parent.parent / "pyproject.toml"
        return tomllib.loads(path.read_text())["project"]["version"]
    return __version__