-
Notifications
You must be signed in to change notification settings - Fork 823
Description
At the moment, MDAnalysis does not use any files for configuration. There are currently three main areas where we use configuration values:
- The flag registry in MDAnalysis.core.flags determines global behavior. In principle, these flags can be changed by the user but in practice this seems to be rarely done. In any case, changes are not persistent and have to be changed for a new python session manually by setting the flag.
- Names for guessing atom elements and masses are stored in MDAnalysis.topology.tables.
- Residue names for special selections such as "protein" or "nucleic" are hard-coded in the specific selection methods in MDAnalysis.core.Selection. Issue Managing default selection keywords #104 wants to change this in particular.
At least 1 and 3 should be configurable through a common mechanism and possibly through an optional preferences file that a user might want to keep in her home directory. MDAnalysis could ship with the default config file that will then be used to load the defaults, making all configurable values very transparent.
The current flag registry is a bit of hack to accomplish a fraction of what ipython/jupyter's traitlets achieve nicely and cleanly with their traitlets.config. traitlets is on PyPi and can be easily added as a dependency. It allows JSON and Python files for configuration and does type checking.
I propose we look into adapting traitlets.config (or something similar) as a basis for a flexible configuration system for MDAnalysis. I'd suggest we start with first transitioning 1 and 3 over to a new configuration system and then add other classes such as the hydrogen bond analysis and the atom typing tables.
Comments, ideas?