Upgrading InfiniteGlass and user configuration
Each time there are changes that affect ~/.config/glass files, I'm ending up having to reedit all the previous customization. Would there be a way to easily migrate configuration files when changes are made?
Hm, this is a tough one, as it requires some kind of merge script... As a hack you could make ~/.config/glass a git repo, commit all the original files, then commit your changes. To upgrade, you'd check out the previous original version as a new branch, remove the files so that new ones appear, commit, change back to master and merge your new branch... a bit clumsy, but should work fine...
Does Python have anything to do json schema migration? By the way, this is not a priority. Just filling issues as they come.
No idea. Also, I haven't written a json schema for any of the files... and... technically they're yaml. I only use the json subset of yaml, except for comments (json doesn't have comments, and I wanted the config files to have doc comments)...
The next big idea would be to use SQLite (already used in InfiniteGlass, right?) to handle all configuration files.
- All configurable properties and their default values in a database.
- Every change will be handled by migrations.
- Converting in and out to YAML files.
This will allow to retain user customization between updates. The migration will know what to do with the existing data. We could also integrate default templates (Scandinavian, Canadian and Russian for example) where it will be possible to define themes, button ordering, default settings, etc.
Perhaps some template system + a migration directory with Python scripts. Each YAML would have a version and the scripts would start from there and update one after another version up to the last version.
https://stackoverflow.com/questions/28557626/how-to-update-yaml-file-using-python
JSON Patch https://pypi.org/project/jsonpatch/ https://tools.ietf.org/html/draft-ietf-appsawg-json-patch-02
JSON Diff https://github.com/fzumstein/jsondiff https://pypi.org/project/deepdiff/ https://pypi.org/project/json-diff/
So none of the patching libs above does diff, and none of the diff libs above does patching, and none of the first group understands a format generated by the second group :(
Most unfortunately. I copy relevant information from our conversations for references. We at least made some progress as far as the appropriate approach.