mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-07 07:55:13 +02:00
fix: improve setup wizard behavior (#127)
* fix: improve setup wizard behavior * fix: derive runtime versions from release metadata * test: validate metabase source mapping requirements * Fix boundary check release identifiers
This commit is contained in:
parent
33a142f769
commit
d1c84e5564
35 changed files with 671 additions and 90 deletions
|
|
@ -1,6 +1,6 @@
|
|||
[project]
|
||||
name = "ktx-daemon"
|
||||
version = "0.1.0"
|
||||
version = "0.0.0+private"
|
||||
description = "Portable compute package for KTX semantic-layer operations"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.13"
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,19 @@
|
|||
from ktx_daemon import PACKAGE_NAME, VERSION
|
||||
from ktx_daemon import PACKAGE_NAME, VERSION, resolve_package_version
|
||||
|
||||
|
||||
def test_package_metadata() -> None:
|
||||
assert PACKAGE_NAME == "ktx-daemon"
|
||||
assert VERSION == "0.1.0"
|
||||
assert VERSION == resolve_package_version()
|
||||
|
||||
|
||||
def test_package_version_prefers_bundled_runtime_distribution() -> None:
|
||||
calls: list[str] = []
|
||||
|
||||
def fake_version(distribution_name: str) -> str:
|
||||
calls.append(distribution_name)
|
||||
if distribution_name == "kaelio-ktx":
|
||||
return "0.1.0rc1"
|
||||
raise AssertionError(f"unexpected distribution lookup: {distribution_name}")
|
||||
|
||||
assert resolve_package_version(version_loader=fake_version) == "0.1.0rc1"
|
||||
assert calls == ["kaelio-ktx"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue