From 1700166945a28e3cab9cc20bd62ed2dd01165e18 Mon Sep 17 00:00:00 2001 From: bahtya Date: Mon, 6 Apr 2026 23:22:34 +0800 Subject: [PATCH] fix: use importlib.metadata for version to prevent mismatch with pyproject.toml Fixes #2856 Previously __version__ was hardcoded as '0.4.1' in __init__.py while pyproject.toml declared version '0.1.5'. This caused nanobot gateway to report version 0.4.1 on startup while pip showed 0.1.5. Now __version__ reads from importlib.metadata.version('nanobot-ai'), keeping pyproject.toml as the single source of truth. --- nanobot/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nanobot/__init__.py b/nanobot/__init__.py index 433dbe139..93be6664c 100644 --- a/nanobot/__init__.py +++ b/nanobot/__init__.py @@ -2,7 +2,9 @@ nanobot - A lightweight AI agent framework """ -__version__ = "0.1.5" +from importlib.metadata import version as _pkg_version + +__version__ = _pkg_version("nanobot-ai") __logo__ = "🐈" from nanobot.nanobot import Nanobot, RunResult