Skip to content
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

Ability to add comments to yaml #767

Closed
nitanmarcel opened this issue Jul 10, 2021 · 3 comments
Closed

Ability to add comments to yaml #767

nitanmarcel opened this issue Jul 10, 2021 · 3 comments

Comments

@nitanmarcel
Copy link

I don't know if this already a feature or not but it would be useful to add comments to the output yaml string.

I have no idea how this could be implemented in dict -> yaml but probably there could be a method that adds a comment next to a value specified on it. On class -> yaml this could be done by reading the class doc attribute and parse it into comments, or still having the function mentioned above.

I don't really have a direct idea on how this could be implemented if not yet available but it would be an useful feature when generating an yaml file based on a class

@omry
Copy link
Owner

omry commented Jul 10, 2021

Something like this might become possible if #131 is implemented.
Closing as it's already on the radar.

@omry omry closed this as completed Jul 10, 2021
@nitanmarcel
Copy link
Author

Something like this might become possible if #131 is implemented. Closing as it's already on the radar.

Haven't use the library for a long time. Any updates on this?

@Jasha10
Copy link
Collaborator

Jasha10 commented Mar 2, 2022

We are working towards the ability to add metadata to structured config fields (#131). Thus dataclasses / attr classes will be able to have e.g. a description or comment or help data.
As for yaml files specifically, there are no plans to add support for comments. Yaml comments would not be round-trippable OmegaConf -> Yaml -> OmegaConf since, according the YAML spec, comments "are a presentation detail and must not have any effect on the serialization tree or representation graph."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants