-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement (or document how to use) other input formats #575
Comments
Hey @molpopgen. The Graph In regard to including support for more formats natively in the library, I'd want to see the serialisation format used elsewhere for Demes files before considering it, to help justify the use case. I mean, we could add support for 20 additional formats with little code, but how useful would this be to users? |
Thanks @grahamgower. After a bit more exploring, I found that several of the demes-spec valid examples are not compatible with JSON or TOML as inputs. For JSON, the infinite start time is the issue. For TOML, the metadata example as I was actually finding the TOML way of doing lists easier of late. My use case is for input for a program that I'm working on. To support the current YAML input, it would be a string literal buried inside a file that is otherwise TOML. Writing it "inline" as TOML is easier. But it sounds like the thing to do is to just add some text to the fromdict docstring. |
The
Graph.fromdict
method lets us accept data from several formats in addition to the current YAML.I have had some motivation recently to explore TOML input for demes, and code like this below "just works":
The contents of the example are:
I also suspect that we get JSON support for free in a similar way.
We could add functions like
demes.loads_toml
(ortoml_loads
??), etc., which would be very thin wrappers around code like the above.Or we can document somewhere that the
asdict
method is more useful than we've let on.Thoughts?
The text was updated successfully, but these errors were encountered: