mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-10 08:05:14 +02:00
fix: derive runtime versions from release metadata
This commit is contained in:
parent
1c30abc51d
commit
8aea27bfbe
18 changed files with 231 additions and 50 deletions
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue