Comments (23)
The PR is open
from yaml.jl.
And maybe maintainer of this package should bump a new release.
from yaml.jl.
Hi everyone,
with the release v0.4.2 it is now possible to read and write arbitrary subtypes of AbstractDict
. With this feature, you can maintain the order of YAML files in a load-save-load roundtrip. All you need to do is to use the new dicttype
argument while reading, which is documented in the README.
from yaml.jl.
Not sure, that was my mistake. Sorry about that
from yaml.jl.
I did make a Julia implementation of writing YAML files: https://github.com/mirkobunse/ComfyCommons.jl/blob/master/src/yaml.jl
If there is still interest and a maintainer willing to review, I'll prepare a pull request from this sketch.
What it already does:
- Write Dicts and Vectors
- Write Strings, Numbers, and so on
- Correct and nice intendation
- A prefix string with comments can be written along with the config
What is currently missing:
- The order of the Dict entries in the written file is arbitrary. Keeping the order of an existing file would require YAML.jl to use ordered dictionaries, which will be easy to do in a PR.
- Comments at arbitrary positions
EDIT: Of course, the Dicts and Vectors can be nested.
from yaml.jl.
Sure, I can open a PR on YAML.jl to make a direct contribution. Thank you, @mlhetland, for keeping an eye on the licenses.
from yaml.jl.
YAML.yaml(...)
will be great!
(like JSON.json(...)
)
from yaml.jl.
Why was this closed without an answer?
from yaml.jl.
I wish I had the time/knowledge to whip this out myself, but at this point I do not -- it would be much easier for someone else with the right knowledge to do it. Yet I really would like to have this functionality, so I am willing to kick in $20 to start a bounty in hopes that it will incentivize the right person. Maybe a few others can kick in as well.
from yaml.jl.
I'll have lots of time available for open-source come mid-December and was planning to devote some of it here so I won't mind working on an implementation for this around then if no one else has done it. No need for a bounty on my end.
Before that though, it would be good to clear up why no development has happened on this package in over a year even though multiple pull requests are open.
from yaml.jl.
@jdlangs that'd be great.
I think the long break since this has been actively worked on is due to two main things: @dcjones
(the author of this package) getting working on his PhD and the YAML parsing routines being stable.
@dcjones
has given me permissions for this repo, so I can manage it going forward. I don't have much time to implement new features myself, but will be able to view/merge pull requests.
from yaml.jl.
Sounds good, and thanks for stepping up to manage the development. It provides a lot of assurance to potential contributors that there's an active maintainer, even if they aren't able to add features themself.
On the same note, aren't there a few pull requests that should have been merged quite a while ago? I'll point out #32 in particular.
from yaml.jl.
@jdlangs, did you (or anyone else) make progress on this?
from yaml.jl.
from yaml.jl.
It would be great if this could be implemented
from yaml.jl.
I've had a look at this, and I guess the amount of effort involved would be closely correlated with the level of ambition.
On the one hand, a simple YAML-emitting mechanism mirroring that of JSON.jl could probably be done in a matter of hours. On the other hand, there is a spectrum of stretch-goals, here. For example, one might want to let the user determine which syntax variants are used to serialize different components, and perhaps include line wrapping as part of the pretty-printing (taking indentation, etc., into account). And, perhaps more usefully, one might want to be able to preserve metadata when parsing, so that one could emit the same syntax forms, and even include the same insignificant whitespace, comments, etc., so that round-tripping via YAML.jl
does not modify the YAML file, and any modifications are local to what is modified, leaving the rest of the file (including comments, etc.) intact. As far as I know, there are tools that do this – but that would require quite a bit more work. I guess one could have a list of features, and see if it's possible to map out an incremental path from the simple emitter to the more integrated library where parser and emitter cooperate, using the same data model (including non-significant information about order, whitespace, comments, syntax variants…).
Another thing I've thought about now and then is whether it might be useful to go the PyYAML route, and simply wrap LibYAML. Of course, that introduces a black box, which is sort of un-Julian, and the conversion to/from Julia types would still have to be there. So maybe it's not that much more useful.
from yaml.jl.
Using ordered dictionaries would be very useful, I think – even though the YAML spec specifically doesn't care about ordering, in applications it can be quite useful if a library supports it. (Specifically having round-tripping, i.e., reading and then writing, not modify things too much. Ideally, it would preserve comments etc., as well, but I guess that requires a richer internal model.)
from yaml.jl.
is there any plans or progress to implement Yaml writing, or just try to incorporate the code @mirkobunse have write?
from yaml.jl.
If @mirkobunse's code is to be used, I guess it would have to be released under some other license, or contributed directly to the YAML.jl project (by @mirkobunse)? At present, it's licensed under GPL 3, and YAML.jl is under MIT.
from yaml.jl.
@kescobo This issue can be closed since #68 has merged.
from yaml.jl.
@mirkobunse, regarding the ordering, TOML has an option to sort when printing.
from yaml.jl.
Thanks for the hint!
However, TOML seems to sort lexicographically. The order in a YAML file can be any order. The preservation of such requires some kind of an ordered dictionary. DataStructures.jl has one, by the way.
from yaml.jl.
I think ordered dictionaries were split off into OrderedCollections.jl.
from yaml.jl.
Related Issues (20)
- Reading/writing of YAML files is broken HOT 3
- YAML.jl inputs numbers (both integer and float) with `_` separators as strings, not numbers.
- Fails on flow sequences HOT 4
- [proposal] (De)serializing (to)from structured types HOT 2
- composer.input return values
- documentation for reading application specific tags
- load_all_file doesn't work with multiple documents
- StrictYAML option? HOT 9
- "Yes" and "No" should not be parsed as Bool HOT 2
- All keys are printed in plain style
- Issues while parsing single quotes `''''` HOT 8
- is there a way to include a YAML in another YAML please? HOT 2
- Crashes if yaml file contains only a comment HOT 2
- YAML file with empty list of list cannot be loaded HOT 2
- load_all fails on Windows
- What version of YAML is this intended to implement? HOT 6
- Allow changing values without deleting comment HOT 1
- 2d arrays get converted into string representation by write_file
- Missing documentation
- expand `~` when opening files HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yaml.jl.