fix: derive runtime versions from release metadata

This commit is contained in:
Andrey Avtomonov 2026-05-17 19:00:34 +02:00
parent 1c30abc51d
commit 8aea27bfbe
18 changed files with 231 additions and 50 deletions

View file

@ -1,6 +1,28 @@
"""Portable compute package for KTX."""
PACKAGE_NAME = "ktx-daemon"
VERSION = "0.1.0"
from collections.abc import Callable
from importlib.metadata import PackageNotFoundError, version
__all__ = ["PACKAGE_NAME", "VERSION"]
PACKAGE_NAME = "ktx-daemon"
RUNTIME_DISTRIBUTION_NAME = "kaelio-ktx"
def resolve_package_version(
version_loader: Callable[[str], str] = version,
) -> str:
for distribution_name in (RUNTIME_DISTRIBUTION_NAME, PACKAGE_NAME):
try:
return version_loader(distribution_name)
except PackageNotFoundError:
continue
return "0.0.0+local"
VERSION = resolve_package_version()
__all__ = [
"PACKAGE_NAME",
"RUNTIME_DISTRIBUTION_NAME",
"VERSION",
"resolve_package_version",
]

View file

@ -10,6 +10,7 @@ from typing import Any
from fastapi import FastAPI, HTTPException
from fastapi.responses import Response
from ktx_daemon import VERSION
from ktx_daemon.code_execution import (
ExecuteCodeRequest,
ExecuteCodeResponse,
@ -84,7 +85,7 @@ def create_app(
app = FastAPI(
title="KTX Daemon",
description="Stateless portable compute server for KTX.",
version="0.1.0",
version=VERSION,
)
@app.get("/health")