-
Notifications
You must be signed in to change notification settings - Fork 192
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
Preserving inline tables #74
Comments
Hi Nate,
Hey @uiri, are there any plans to support preserving inline tables in the `dumps` function. If not would you be open to a PR implementing such functionality?
I do not have any immediate plans to add this support. However, I am always open to pull requests.
While `loads` handles this just fine, serializing back to TOML creates a subsection. This is creating maintainability problems, in some cases, since things are moving around in the TOML file unexpectedly. It would be nice if the data structure was written back out as it was ingested, if possible.
I would recommend calling `loads` with the _dict parameter set to an OrderedDict. This (or another custom dictionary type) might help your issue. If you still find the need to make changes to the toml code, I would recommend adding a boolean flag to `dumps`. That way the current behaviour can stay as the default.
|
Unfortunately, we're already doing that to no avail.
Yep, I was thinking a preservation flag for opt in, so it won't affect current users. I'll take a look into setting that up, thanks! |
Fixed at 87993ce (I believe) |
Hey @uiri, are there any plans to support preserving inline tables in the
dumps
function. If not would you be open to a PR implementing such functionality?Right now, I have a project with users supplying TOML, often using the inline tables syntax:
value = {extra = ["values",]}
While
loads
handles this just fine, serializing back to TOML creates a subsection. This is creating maintainability problems, in some cases, since things are moving around in the TOML file unexpectedly. It would be nice if the data structure was written back out as it was ingested, if possible.Thanks for your consideration!
The text was updated successfully, but these errors were encountered: