OpenVoiceOS / zzz-old-ovos-utils

collection of simple utilities for use across the mycroft ecosystem
Apache License 2.0
4 stars 2 forks source link

feat/configurable_config #74

Closed JarbasAl closed 3 years ago

JarbasAl commented 3 years ago

allows downstreams (ovos-core / chatterbox / neon / HolmesV ...) to change the .config path

companion PR to https://github.com/HelloChatterbox/HolmesV/pull/33 and https://github.com/HelloChatterbox/HolmesV/pull/48

usage

from os.path import dirname, join

OVOS_ROOT_PATH = dirname(dirname(__file__))

# configure HolmesV
import mycroft.configuration
mycroft.configuration.set_config_filename(file_name="ovos.conf", core_folder="ovos")
mycroft.configuration.set_default_config(join(OVOS_ROOT_PATH, "ovos_core", "configuration", "ovos.conf"))

# configure ovos_utils
from ovos_utils.system import set_root_path
from ovos_utils.configuration import set_config_filename, set_default_config
set_root_path(OVOS_ROOT_PATH)
set_config_filename(name="ovos.conf", core_folder="ovos")
set_default_config(join(OVOS_ROOT_PATH, "ovos_core", "configuration", "ovos.conf"))
JarbasAl commented 3 years ago

skills folder util now also respect the new params, different cores that respect XDG can now set the folder name (load ovos skills from ovos folder, not from skills folder)

this PR should essentially allow different cores to co exist nicely

see companion commit in mock-msm https://github.com/HelloChatterbox/mock-msm/commit/180f8988f63f36510b735a636aa0d1c8fb755de7

NOTE: msm itself does not support this, only mock-msm, msm is locked to mycroft decisions and i can't do anything about that, but most non-vanilla mycroft installs wont use msm at all so not an issue for derivative works

ChanceNCounter commented 3 years ago

Needs to be tested on-device. I defer to Daniel.

The example snippet, could/should the mycroft.config portion be fed a getter from ovos_utils, rather than needing to hardcode it twice?

edit: addressed in core. Allows HolmesV to exist without ovos_utils. I thought ovos_utils was a dep of a dep of HolmesV's, but I've just looked, and I was mistaken.