moonraker: report the api version

Start tracking the Remote API version separately from the application
version.  This allows the API to stick to semantic versioning while
and track the application version separately.  This is necessary as
we prepare to release a beta.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2022-02-23 11:15:46 -05:00
parent 8b8cb66481
commit f83f476f81
1 changed files with 10 additions and 1 deletions

View File

@ -41,6 +41,7 @@ from typing import (
Coroutine,
Dict,
List,
Tuple,
Union,
TypeVar,
)
@ -50,6 +51,8 @@ if TYPE_CHECKING:
FlexCallback = Callable[..., Optional[Coroutine]]
_T = TypeVar("_T")
API_VERSION = (1, 0, 0)
CORE_COMPONENTS = [
'dbus_manager', 'database', 'file_manager', 'klippy_apis',
'machine', 'data_store', 'shell_command', 'proc_stats',
@ -126,6 +129,9 @@ class Server:
def get_event_loop(self) -> EventLoop:
return self.event_loop
def get_api_version(self) -> Tuple[int, int, int]:
return API_VERSION
def is_running(self) -> bool:
return self.server_running
@ -398,7 +404,9 @@ class Server:
'warnings': self.warnings,
'websocket_count': wsm.get_count(),
'moonraker_version': self.app_args['software_version'],
'missing_klippy_requirements': mreqs
'missing_klippy_requirements': mreqs,
'api_version': API_VERSION,
'api_version_string': ".".join([str(v) for v in API_VERSION])
}
async def _handle_config_request(self,
@ -420,6 +428,7 @@ def main(cmd_line_args: argparse.Namespace) -> None:
app_args['log_file'] = os.path.normpath(
os.path.expanduser(cmd_line_args.logfile))
app_args['software_version'] = version
app_args['python_version'] = sys.version.replace("\n", " ")
ql, file_logger, warning = utils.setup_logging(app_args)
if warning is not None:
app_args['log_warning'] = warning