Feature Request: Serialization for other file types
Is your feature request related to a problem? Please describe.
My use case involves
- Writing configuration files by hand specifying the values of various Parameters in some easy-to-read format.
- Deserializing the values stored in those files into a set of Parameterized instances.
Currently, the only file type that can be (de)serialized by param is JSON. It works, but is not very readable. It also does not support comments. It would be nice if param supported alternatives to JSON. If given the choice, I almost never pick JSON.
Describe the solution you'd like
Additional Serialization subclasses in serialization.py.
In particular, TOML is a dictionary-like structure similar to JSON. The library toml that has loads and dumps (de)serialization that functions similarly to JSON. I believe it wouldn't be particularly complicated.
YAML is another common type with (de)serialization between file and dictionary. It's a bit more complicated than TOML since the go-to library, PyYAML, is limited to YAML 1.1. There's a better library called ruamel.yaml that supports YAML 1.2. However, it hasn't hit a major version yet.
Describe alternatives you've considered
I've handled INI, JSON, and YAML (de)serialization in my personal repository.
Additional context
This request follows my discussion with @jbednar and @jlstevens. In addition to #482, I plan on writing two more feature requests: one for populating parameterized instances with deserialized dictionaries and another for integration with argparse.
I am happy to write the PR for this feature request, but wanted confirmation that this was indeed desirable functionality from the devs.
Thanks for your time, Sean
Ugh, it looks like TOML compliance is more confusing than I thought. Some care ought to be taken to pick an appropriate backend there as well.