Config loaders
Created by: stanislaw47
Hello Taurus community This PR provides what I wanted in Taurus for long time: ability for load configuration for TaurusGUI from JSON.
I created abstraction for config source, be it a Python module or XML/JSON file. In that way, adding support for any other config file format, like TOML or YAML should be trivial. TaurusGUI now loads configuration by accessing fields of *ConfigLoader
class. Whole interface of *ConfigLoader
class is defined in AbstractConfigLoader
by using Python abc
module.
All discovery logic happens in taurus.qt.qtgui.taurusgui.config_loader.getLoader
function. It matches loaders by file extensions. In case of directory or non-existing path, it tries to use PyConfigLoader
. In case of using entry-points, logic has to be moved elsewhere but for the moment I do not know how to achieve it, especially when taking into account possibility to pass directory and Python module path.
Regarding abc.ABC
class for Python 2 and 3 - I know that Taurus uses future
package for compatibility. However, I did not found anything there about providing abc.ABC
so I created my own compatibility from what I found on StackOverflow.
Things to do:
-
test for loading configuration from different sources -
backward compatibility tests -
entry-point for registering custom config loaders