You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently apptools.preferences uses .ini files mediated by ConfigObj. This was a reasonable choice in 2008, but now there are other possible configuration file formats that might be reasonably used. Candidates include:
JSON
YAML
TOML
XML
Different applications may want to used different formats because they are easier to manually write, or because they need to be interpreted by other systems where .ini format does not have an easily available reader; or integrate with existing systems which have made different choices. Also the long-term future of ConfigObj is unclear - it works, but is also not being updated frequently.
Fortunately the actual file-handling code in the main Preferences is wholly contained within the save and load functions. It would be straightforward to add hooks to read from different formats based on file extensions; and to write to a particular format based on configuration of the preferences system.
One consideration is that the current system assumes that all data is text, while other systems permit additional data types for things like numbers, lists and mappings. This is primarily an issue for reading of files, particularly if they have been manually edited; other value types may need to be explicitly cast to strings.
Similarly, other formats have notions of hierarchical structure which have been imposed on the .ini format manually (by .-separated section names). Some thought may need to be put into how we want to handle this: do we want a flat structure with .-separated sections, or a nested structure using the components.
The text was updated successfully, but these errors were encountered:
I think the dependence on the configobj package is going to become untenable longer term. The last release of that package was over 7 years ago. One way in which it might fail is that configobj still requires six, and I could see six becoming unsupported in some future version of Python (there are already bits of six that issue warnings with Python 3.8 and fail with Python 3.9, for example).
Currently
apptools.preferences
uses .ini files mediated byConfigObj
. This was a reasonable choice in 2008, but now there are other possible configuration file formats that might be reasonably used. Candidates include:Different applications may want to used different formats because they are easier to manually write, or because they need to be interpreted by other systems where .ini format does not have an easily available reader; or integrate with existing systems which have made different choices. Also the long-term future of
ConfigObj
is unclear - it works, but is also not being updated frequently.Fortunately the actual file-handling code in the main
Preferences
is wholly contained within thesave
andload
functions. It would be straightforward to add hooks to read from different formats based on file extensions; and to write to a particular format based on configuration of the preferences system.One consideration is that the current system assumes that all data is text, while other systems permit additional data types for things like numbers, lists and mappings. This is primarily an issue for reading of files, particularly if they have been manually edited; other value types may need to be explicitly cast to strings.
Similarly, other formats have notions of hierarchical structure which have been imposed on the .ini format manually (by
.
-separated section names). Some thought may need to be put into how we want to handle this: do we want a flat structure with.
-separated sections, or a nested structure using the components.The text was updated successfully, but these errors were encountered: