Use same version number for server and webapp, add CI check

- Check webapp and server have same version number
- Use `genversion` on build to create javascript file with version string
from pyproject.toml
- Expose the version number in the js interface
- Correct format of current of alpha version string because javascript complains

Closes #382
This commit is contained in:
Julian Stirling 2025-06-09 12:08:31 +01:00
parent 24b6eb74a1
commit c79184a6d9
8 changed files with 267 additions and 9 deletions

26
check_version_sync.py Executable file
View file

@ -0,0 +1,26 @@
#! /usr/bin/env python3
"""
A script to check that th npm version string matches the python
version string exactly.
"""
import json
import tomllib
import os
with open("pyproject.toml", "rb") as toml_f:
pyproject_data = tomllib.load(toml_f)
with open(os.path.join("webapp", "package.json"), "r", encoding="utf-8") as json_f:
webapp_data = json.load(json_f)
py_ver = pyproject_data["project"]["version"]
js_ver = webapp_data["version"]
assert py_ver == js_ver, (
"The python and javascript version numbers should match.\n"
f"Python version: {py_ver}\n"
f"Javascript version: {js_ver}\n"
""
)