fix: unify version to 1.5.1 from single source (pyproject.toml)

- pyproject.toml: 1.4.0 → 1.5.1 (single source of truth)
- formatters.py: hardcoded 0.9.0 → importlib.metadata
- telemetry/client.py: hardcoded 1.5.0 → importlib.metadata
- server/models.py + app.py: hardcoded 1.5.0 → importlib.metadata
- All fallback to "1.5.1" if package not installed in editable mode

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Val-sss
2026-05-06 19:47:24 +08:00
parent 53c08a4e28
commit 17b6076945
5 changed files with 21 additions and 6 deletions

View File

@@ -90,7 +90,11 @@ def verbose_callback(stage: str, detail: str):
console.print(f" [{color}]> {detail}[/{color}]")
VERSION = "0.9.0"
try:
from importlib.metadata import version as _pkg_version
VERSION = _pkg_version("kwcode")
except Exception:
VERSION = "1.5.1"
# ── Shadow/重影大字 KAIWU ──
_KAIWU_SHADOW = [

View File

@@ -38,9 +38,10 @@ def create_app(
)
from kaiwu.server.pipeline_factory import build_pipeline
from kaiwu.server.models import _VERSION
app = FastAPI(
title="KwCode Server",
version="1.5.0",
version=_VERSION,
description="KwCode coding agent HTTP API with SSE streaming",
)
@@ -78,7 +79,7 @@ def create_app(
async def health():
return HealthResponse(
status="ok",
version="1.5.0",
version=_VERSION,
model=ollama_model or "local",
project_root=project_root,
)

View File

@@ -5,6 +5,12 @@ Pydantic models for kwcode server API.
from typing import Optional
from pydantic import BaseModel, Field
try:
from importlib.metadata import version as _pkg_version
_VERSION = _pkg_version("kwcode")
except Exception:
_VERSION = "1.5.1"
class TaskRequest(BaseModel):
"""Request to submit a task."""
@@ -33,7 +39,7 @@ class TaskResult(BaseModel):
class HealthResponse(BaseModel):
"""Health check response."""
status: str = "ok"
version: str = "1.5.0"
version: str = _VERSION
model: str = ""
project_root: str = ""

View File

@@ -22,7 +22,11 @@ logger = logging.getLogger(__name__)
TELEMETRY_URL = "https://llmbbs.com/api/v1/event"
CONFIG_PATH = Path.home() / ".kwcode" / "config.yaml"
VERSION = "1.5.0"
try:
from importlib.metadata import version as _pkg_version
VERSION = _pkg_version("kwcode")
except Exception:
VERSION = "1.5.1"
_HMAC_SECRET = b"kwcode-telemetry-2026-v1"

View File

@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "kwcode"
version = "1.4.0"
version = "1.5.1"
description = "KwCode - Local-model coding agent with MoE expert pipeline"
requires-python = ">=3.10"
readme = "README.md"