Proposal for a centralized configuration system
As we see today, many of our applications and libraries need to load global configuration. In this ticket, I open the discussion to port the current framework for configuration in bob/bob.bio.base to a centralized package so that it can be re-used by both low and high-level packages. In particular, I'm targeting what we can do today with ~/.bob_bio_databases.txt
, the mechanism to handle original (raw) data directories and extensions.
The proposal is three-fold:
- Have a centralised configuration mechanism to setup global parameters needed by the different bob packages (this may include original directories and extensions for bob.db packages, but may also be other stuff). This would replace the mechanism we currently have with
~/.bob_bio_databases.txt
with something similar that could be re-used for other high-level applications. - Let the low-level databases figure this information out from the global configuration
- High-level applications should only do something like this:
>>> db = bob.db.LowLevelDatabase() #loads relevant config section, store directory and extension
>>> sample = db.objects(<criteria>)
>>> data = sample.load()
With this new model, overriding can still happen in the high-level, but it does not need be unless strictly necessary. To implement the override, the high-level implementor asks users to change the config file, replacing the adequate entry on it. Readout remains the same in both cases which simplifies the high-level applications.
(c.f. bob.db.base#21 (closed))