holoviz / holoviz/param

Feature Request: Serialization for other file types

Open
#485 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
521
Forks
86
Avg merge
1d 13h
Merged PRs (30d)
35

Description

#### Is your feature request related to a problem? Please describe.
My use case involves

1) Writing configuration files by hand specifying the values of various Parameters in some easy-to-read format.
2) 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](https://en.wikipedia.org/wiki/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](https://en.wikipedia.org/wiki/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](https://pyyaml.org/), is limited to YAML 1.1. There's a better library called [ruamel.yaml](https://yaml.readthedocs.io/en/latest/overview.html) 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.