Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.0.11 #78

Merged
merged 47 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
8b44ee0
Update mycroft.conf (#55)
JarbasAl Jul 2, 2023
523edee
Increment Version to 0.0.11a1
JarbasAl Jul 2, 2023
b192c2f
Update Changelog
JarbasAl Jul 2, 2023
6adbeaa
document dinkum listener (#57)
JarbasAl Jul 4, 2023
932c1ad
Increment Version to 0.0.11a2
JarbasAl Jul 4, 2023
29fe4ba
Update Changelog
JarbasAl Jul 4, 2023
bdba2a8
default g2p to ovos-g2p-plugin-heuristic-arpa (#56)
JarbasAl Jul 4, 2023
d50b093
Increment Version to 0.0.11a3
JarbasAl Jul 4, 2023
d675e00
Update Changelog
JarbasAl Jul 4, 2023
725593f
change connectivity check urls (#60)
JarbasAl Jul 13, 2023
a6ccbc3
Increment Version to 0.0.11a4
JarbasAl Jul 13, 2023
dc7b74a
Update Changelog
JarbasAl Jul 13, 2023
c3752e7
Fix infinitely recursive callback (#61)
NeonDaniel Jul 21, 2023
30cafe9
Increment Version to 0.0.11a5
NeonDaniel Jul 21, 2023
a053448
Update Changelog
NeonDaniel Jul 21, 2023
1a6c940
Check file existence before getting mtime (#62)
NeonDaniel Jul 26, 2023
f7f8b00
Increment Version to 0.0.11a6
NeonDaniel Jul 26, 2023
44942c9
Update Changelog
NeonDaniel Jul 26, 2023
e69ed97
update config (#63)
JarbasAl Aug 7, 2023
45a21c3
Increment Version to 0.0.11a7
JarbasAl Aug 7, 2023
e51d4d1
Update Changelog
JarbasAl Aug 7, 2023
d3a6bb0
Log deprecation of FileWatcher classes in `.utils` (#64)
NeonDaniel Aug 8, 2023
e39d5ab
Increment Version to 0.0.11a8
JarbasAl Aug 8, 2023
fe95766
Update Changelog
JarbasAl Aug 8, 2023
5b05e0f
fix subclassing for deprecation (#65)
JarbasAl Aug 8, 2023
357851d
Increment Version to 0.0.11a9
JarbasAl Aug 8, 2023
960e8d4
Update Changelog
JarbasAl Aug 8, 2023
85c079e
Update default translation plugin (#66)
JarbasAl Aug 22, 2023
283b045
Increment Version to 0.0.11a10
JarbasAl Aug 22, 2023
2660981
Update Changelog
JarbasAl Aug 22, 2023
2a3e24b
[cache] Add persistent cache options (#68)
goldyfruit Aug 30, 2023
e9869bc
Increment Version to 0.0.11a11
JarbasAl Aug 30, 2023
bece0cf
Update Changelog
JarbasAl Aug 30, 2023
4cdd581
Fix typo'd "loosly" (#72)
strugee Sep 17, 2023
b9759d7
Increment Version to 0.0.11a12
JarbasAl Sep 17, 2023
1b04180
Update Changelog
JarbasAl Sep 17, 2023
8232d00
fix remote config reload (#74)
emphasize Sep 18, 2023
7d0f6ab
Increment Version to 0.0.11a13
JarbasAl Sep 18, 2023
dd7f9d2
Update Changelog
JarbasAl Sep 18, 2023
06658d7
add max_msg_size (#76)
JarbasAl Oct 18, 2023
f5e3e73
Increment Version to 0.0.11a14
JarbasAl Oct 18, 2023
f10e166
Update Changelog
JarbasAl Oct 18, 2023
a9b1f22
Minor dependency and logging updates (#77)
NeonDaniel Oct 24, 2023
761ea0a
Increment Version to 0.0.11a15
JarbasAl Oct 24, 2023
690aeac
Update Changelog
JarbasAl Oct 24, 2023
6ccf1d4
Increment Version to 0.0.11
NeonDaniel Oct 25, 2023
0cc0efa
Update Changelog
NeonDaniel Oct 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 99 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,121 @@
# Changelog

## [V0.0.10a3](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.10a3) (2023-05-31)
## [V0.0.11a15](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a15) (2023-10-24)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.10a2...V0.0.10a3)
[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.11a14...V0.0.11a15)

**Merged pull requests:**

- Minor dependency and logging updates [\#77](https://github.com/OpenVoiceOS/ovos-config/pull/77) ([NeonDaniel](https://github.com/NeonDaniel))

## [V0.0.11a14](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a14) (2023-10-18)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.11a13...V0.0.11a14)

**Merged pull requests:**

- add max\_msg\_size [\#76](https://github.com/OpenVoiceOS/ovos-config/pull/76) ([JarbasAl](https://github.com/JarbasAl))

## [V0.0.11a13](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a13) (2023-09-18)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.11a12...V0.0.11a13)

**Fixed bugs:**

- fix remote config reload [\#74](https://github.com/OpenVoiceOS/ovos-config/pull/74) ([emphasize](https://github.com/emphasize))

## [V0.0.11a12](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a12) (2023-09-17)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.11a10...V0.0.11a12)

**Merged pull requests:**

- Fix typo'd "loosly" [\#72](https://github.com/OpenVoiceOS/ovos-config/pull/72) ([strugee](https://github.com/strugee))
- \[cache\] Add persistent cache options [\#68](https://github.com/OpenVoiceOS/ovos-config/pull/68) ([goldyfruit](https://github.com/goldyfruit))

## [V0.0.11a10](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a10) (2023-08-22)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.11a9...V0.0.11a10)

**Implemented enhancements:**

- Update default translation plugin [\#66](https://github.com/OpenVoiceOS/ovos-config/pull/66) ([JarbasAl](https://github.com/JarbasAl))

## [V0.0.11a9](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a9) (2023-08-08)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.11a8...V0.0.11a9)

**Fixed bugs:**

- Update config hash to sort keys to ensure hashes compare [\#52](https://github.com/OpenVoiceOS/ovos-config/pull/52) ([NeonDaniel](https://github.com/NeonDaniel))
- fix subclassing for deprecation [\#65](https://github.com/OpenVoiceOS/ovos-config/pull/65) ([JarbasAl](https://github.com/JarbasAl))

## [V0.0.11a8](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a8) (2023-08-08)

## [V0.0.10a2](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.10a2) (2023-05-31)
[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.11a7...V0.0.11a8)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.10a1...V0.0.10a2)
**Merged pull requests:**

- Log deprecation of FileWatcher classes in `.utils` [\#64](https://github.com/OpenVoiceOS/ovos-config/pull/64) ([NeonDaniel](https://github.com/NeonDaniel))

## [V0.0.11a7](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a7) (2023-08-07)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.11a6...V0.0.11a7)

**Implemented enhancements:**

- update config [\#63](https://github.com/OpenVoiceOS/ovos-config/pull/63) ([JarbasAl](https://github.com/JarbasAl))

## [V0.0.11a6](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a6) (2023-07-26)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.11a5...V0.0.11a6)

**Merged pull requests:**

- Add config path checks before mtime checks [\#62](https://github.com/OpenVoiceOS/ovos-config/pull/62) ([NeonDaniel](https://github.com/NeonDaniel))

## [V0.0.11a5](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a5) (2023-07-21)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.11a4...V0.0.11a5)

**Merged pull requests:**

- Fix infinitely recursive callback [\#61](https://github.com/OpenVoiceOS/ovos-config/pull/61) ([NeonDaniel](https://github.com/NeonDaniel))

## [V0.0.11a4](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a4) (2023-07-13)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.11a3...V0.0.11a4)

**Closed issues:**

- Clean install failed on missing ovos-tts-plugin-mimic [\#49](https://github.com/OpenVoiceOS/ovos-config/issues/49)
- Some fields not updating as expected using single command line [\#58](https://github.com/OpenVoiceOS/ovos-config/issues/58)

**Merged pull requests:**

- Skip config file reload when a non-config file is modified [\#51](https://github.com/OpenVoiceOS/ovos-config/pull/51) ([NeonDaniel](https://github.com/NeonDaniel))
- change connectivity check urls [\#60](https://github.com/OpenVoiceOS/ovos-config/pull/60) ([JarbasAl](https://github.com/JarbasAl))

## [V0.0.11a3](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a3) (2023-07-04)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.11a2...V0.0.11a3)

**Implemented enhancements:**

- default g2p to ovos-g2p-plugin-heuristic-arpa [\#56](https://github.com/OpenVoiceOS/ovos-config/pull/56) ([JarbasAl](https://github.com/JarbasAl))

## [V0.0.11a2](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a2) (2023-07-04)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.11a1...V0.0.11a2)

**Implemented enhancements:**

- document dinkum listener [\#57](https://github.com/OpenVoiceOS/ovos-config/pull/57) ([JarbasAl](https://github.com/JarbasAl))

## [V0.0.10a1](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.10a1) (2023-05-29)
## [V0.0.11a1](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a1) (2023-07-02)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.9...V0.0.10a1)
[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.10...V0.0.11a1)

**Merged pull requests:**

- refactor/better\_defaults [\#50](https://github.com/OpenVoiceOS/ovos-config/pull/50) ([JarbasAl](https://github.com/JarbasAl))
- Update mycroft.conf [\#55](https://github.com/OpenVoiceOS/ovos-config/pull/55) ([JarbasAl](https://github.com/JarbasAl))



Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Given an entry of

* `ovos-config set`

* Searches loosly for keys containing the query string and presents a choice to the user to define a value
* Searches loosely for keys containing the query string and presents a choice to the user to define a value

`ovos-config set -k phal`

Expand Down
2 changes: 1 addition & 1 deletion ovos_config/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def set(key, value):
"""\b
Sets a config key in the user configuration
\b
Loosly searches a config key and if multiple are found asks which key and value should be written.
Loosely searches a config key and if multiple are found asks which key and value should be written.
The user may pass a value to bypass prompting.
\b
Examples:
Expand Down
22 changes: 7 additions & 15 deletions ovos_config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@
import json
from os.path import isfile
from typing import Optional
from time import sleep

from ovos_config.models import LocalConf, MycroftDefaultConfig, \
MycroftSystemConfig, MycroftUserConfig, RemoteConf
from ovos_config.locations import OLD_USER_CONFIG, get_xdg_config_save_path, \
get_xdg_config_locations
from ovos_config.utils import FileWatcher
from ovos_utils.file_utils import FileWatcher

from ovos_utils.json_helper import flattened_delete, merge_dict
from ovos_utils.log import LOG
Expand Down Expand Up @@ -299,25 +298,18 @@ def _on_file_change(path: str):
old_cfg = hash(cfg)
try:
cfg.reload()
reloaded = True
except:
# got the file changed signal before write finished
sleep(0.5)
reloaded = False
try:
if not reloaded:
LOG.warning(f"Reload failed, retrying")
cfg.reload()
except:
LOG.exception("Failed to load configuration, "
"syntax seems invalid!")
except Exception as e:
# Filewatcher only calls this on file close, so this
# is really an error
LOG.exception(f"Failed to load: {path}: {e}")

new_cfg = hash(cfg)
if old_cfg == new_cfg:
LOG.info(f"{path} unchanged")
return
break
else:
LOG.info(f"Ignoring non-config file change: {path}")
LOG.debug(f"Ignoring non-config file change: {path}")
return

LOG.info(f'{path} changed on disk')
Expand Down
31 changes: 23 additions & 8 deletions ovos_config/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
# limitations under the License.
#
import json
from os.path import exists, isfile
from combo_lock import NamedLock
import yaml

from time import time
from os.path import exists, isfile, getmtime
from combo_lock import NamedLock
from ovos_utils.json_helper import load_commented_json, merge_dict
from ovos_utils.log import LOG

Expand Down Expand Up @@ -54,13 +56,14 @@ class LocalConf(dict):
allow_overwrite = True
# lock is shared among all subclasses,
# regardless of what file is being edited only one file should change at a time
# this ensure orderly behaviour in anything monitoring changes,
# this ensures orderly behaviour in anything monitoring changes,
# eg FileWatcher util, configuration.patch bus handlers
__lock = NamedLock("ovos_config")

def __init__(self, path):
super().__init__(self)
self.path = path
self._last_loaded = None
if path:
self.load_local(path)

Expand All @@ -85,7 +88,8 @@ def _get_file_format(self, path=None):
return "json"

def load_local(self, path=None):
"""Load local json file into self.
"""
Load local json file into self.

Args:
path (str): file to load
Expand All @@ -110,10 +114,16 @@ def load_local(self, path=None):
LOG.debug(f"Empty config found at: {path}")
except Exception as e:
LOG.exception(f"Error loading configuration '{path}'")
if path == self.path and isfile(self.path):
self._last_loaded = getmtime(self.path)
else:
LOG.debug(f"Configuration '{path}' not defined, skipping")

def reload(self):
if isfile(self.path) and self._last_loaded == getmtime(self.path):
LOG.debug(f"{self.path} not changed since last load "
f"(changed {time() - self._last_loaded} seconds ago)")
return
self.load_local(self.path)

def store(self, path=None):
Expand Down Expand Up @@ -179,7 +189,7 @@ def __init__(self, allow_overwrite=False):


class RemoteConf(LocalConf):
"""Config dictionary fetched from mycroft.ai."""
"""Config dictionary fetched from the backend"""

def __init__(self, cache=WEB_CONFIG_CACHE):
super(RemoteConf, self).__init__(cache)
Expand All @@ -194,12 +204,17 @@ def reload(self):
return

remote = RemoteConfigManager()

remote.download()

changed = []
for key in remote.config:
self.__setitem__(key, remote.config[key])
if self.get(key) != remote.config[key]:
changed.append(key)
self.__setitem__(key, remote.config[key])

self.store(self.path)
if changed:
LOG.debug(f"config key(s) {changed} changed, writing remote config to {self.path}")
self.store(self.path)

except Exception as e:
LOG.error(f"Exception fetching remote configuration: {e}")
Expand Down
Loading
Loading