From 6d7cf6331c58f178d78a92d1b965192fcd67b86f Mon Sep 17 00:00:00 2001 From: jarbasai Date: Tue, 7 Feb 2023 22:51:51 +0000 Subject: [PATCH] feat/runtime_requirements gui --- ovos_utils/network_utils.py | 24 ++---------------------- ovos_utils/process_utils.py | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/ovos_utils/network_utils.py b/ovos_utils/network_utils.py index c125b2c5..63ee06d9 100644 --- a/ovos_utils/network_utils.py +++ b/ovos_utils/network_utils.py @@ -1,27 +1,7 @@ import socket import requests -from dataclasses import dataclass - - -@dataclass -class NetworkRequirements: - # to ensure backwards compatibility the default values require internet before skill loading - # skills in the wild may assume this behaviour and require network on initialization - # any ovos aware skills should change these as appropriate - - # xxx_before_load is used by skills service - network_before_load: bool = True - internet_before_load: bool = True - - # requires_xxx is currently purely informative and not consumed by core - # this allows a skill to spec if it needs connectivity to handle utterances - requires_internet: bool = True - requires_network: bool = True - - # xxx_fallback is currently purely informative and not consumed by core - # this allows a skill to spec if it has a fallback for temporary offline events, eg, by having a cache - no_internet_fallback: bool = False - no_network_fallback: bool = False +# backwards compat +from ovos_utils.process_utils import RuntimeRequirements as NetworkRequirements def get_ip(): diff --git a/ovos_utils/process_utils.py b/ovos_utils/process_utils.py index cfdb7198..11e327b2 100644 --- a/ovos_utils/process_utils.py +++ b/ovos_utils/process_utils.py @@ -1,6 +1,31 @@ import sys from collections import namedtuple from enum import IntEnum +from dataclasses import dataclass + + +@dataclass +class RuntimeRequirements: + # to ensure backwards compatibility the default values require internet before skill loading + # skills in the wild may assume this behaviour and require network on initialization + # any ovos aware skills should change these as appropriate + + # xxx_before_load is used by skills service + network_before_load: bool = True + internet_before_load: bool = True + gui_before_load: bool = False + + # requires_xxx is currently purely informative and not consumed by core + # this allows a skill to spec if it needs connectivity to handle utterances + requires_internet: bool = True + requires_network: bool = True + requires_gui: bool = False + + # xxx_fallback is currently purely informative and not consumed by core + # this allows a skill to spec if it has a fallback for temporary offline events, eg, by having a cache + no_internet_fallback: bool = False + no_network_fallback: bool = False + no_gui_fallback: bool = True # can work voice only class ProcessState(IntEnum):