mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-19 04:16:26 +00:00
Improve version reporting, adding git status if available
This commit is contained in:
1 parent
a0c8da26e8
commit
34fc910210
3 files changed
+23
-3
No files matched your search
@@ -235,6 +235,7 @@ ignore = [
|
||||
"SIM103", # forbids multiple returns
|
||||
"SIM110", # requires use of any(...) instead of for-loop
|
||||
"G001", # forbids str.format in log statements
|
||||
"E722", # forbids unspecific except clause
|
||||
]
|
||||
unfixable = [
|
||||
"F841",
|
||||
|
||||
+20
-1
@@ -1,7 +1,26 @@
|
||||
__version__ = "0.1.0-dev1"
|
||||
__version__ = "2025-04-07"
|
||||
|
||||
|
||||
def serena_root_path() -> str:
|
||||
from pathlib import Path
|
||||
|
||||
return str(Path(__file__).parent.parent.parent.absolute())
|
||||
|
||||
|
||||
def serena_version() -> str:
|
||||
"""
|
||||
:return: the version of the package, including git status if available.
|
||||
"""
|
||||
version = __version__
|
||||
try:
|
||||
from sensai.util.git import git_status
|
||||
from sensai.util.logging import LoggingDisabledContext
|
||||
|
||||
with LoggingDisabledContext():
|
||||
git_status = git_status()
|
||||
version += f"-{git_status.commit[:8]}"
|
||||
if not git_status.is_clean:
|
||||
version += "-dirty"
|
||||
except:
|
||||
pass
|
||||
return version
|
||||
+2
-2
@@ -22,7 +22,7 @@ from multilspy import SyncLanguageServer
|
||||
from multilspy.multilspy_config import Language, MultilspyConfig
|
||||
from multilspy.multilspy_logger import MultilspyLogger
|
||||
from multilspy.multilspy_types import SymbolKind
|
||||
from serena import __version__, serena_root_path
|
||||
from serena import serena_root_path, serena_version
|
||||
from serena.gui_log_viewer import GuiLogViewer, GuiLogViewerHandler
|
||||
from serena.llm.prompt_factory import PromptFactory
|
||||
from serena.symbol import SymbolLocation, SymbolManager
|
||||
@@ -145,7 +145,7 @@ class SerenaAgent:
|
||||
self._gui_log_handler = GuiLogViewerHandler(GuiLogViewer(title="Serena Logs"), level=log_level, format_string=LOG_FORMAT)
|
||||
Logger.root.addHandler(self._gui_log_handler)
|
||||
|
||||
log.info(f"Starting Serena server (version={__version__}, process id={os.getpid()}, parent process id={os.getppid()})")
|
||||
log.info(f"Starting Serena server (version={serena_version()}, process id={os.getpid()}, parent process id={os.getppid()})")
|
||||
log.info("Available projects: {}".format(", ".join(self.serena_config.project_names)))
|
||||
|
||||
self.prompt_factory = PromptFactory()
|
||||
|
||||
Reference in new issue
Block a user