-
-
Notifications
You must be signed in to change notification settings - Fork 100
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
Support Decimal
serialization?
#288
Comments
This was referenced May 12, 2023
Closed
goodboy
added a commit
to pikers/piker
that referenced
this issue
May 17, 2023
We still need to get some patches landed in order to resolve: - python-poetry/tomlkit#288 - python-poetry/tomlkit#289 - python-poetry/tomlkit#290 But, this does work for style preservation and the inline-table style we were previously hacking into the `toml` lib in `.accounting._toml`, which we can pretty much just drop now B) Relates to #496 (pretty much solves it near-term i think?)
goodboy
added a commit
to pikers/tomlkit
that referenced
this issue
May 25, 2023
For `decimal.Decimal` we can just encode as a `String` and leave it up to the user how to decode the value on load. For `dict` it's quite handy to just render any type that quacks like a `MutableMapping` to a table. Resolves python-poetry#288 and python-poetry#289 but still needs tests!
2 tasks
goodboy
added a commit
to pikers/tomlkit
that referenced
this issue
May 25, 2023
For `decimal.Decimal` we can just encode as a `String` and leave it up to the user how to decode the value on load. For `dict` it's quite handy to just render any type that quacks like a `MutableMapping` to a table. Resolves python-poetry#288 and python-poetry#289 but still needs tests!
As per discussion in #294 it makes more sense to just expect users to define a custom encoder since there's no type support in the TOML spec for Those looking for a solution can defer to @frostming's comment linked above. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Love this lib btw, it's been a huge headache trying to write a certain style of
TOML
with anything else; code base is also very easy to nav, so big 👍🏼So the
tomli
lib has this and it'd sure be handy to have here instead of having to traverse a tree to convert everything tostr
first 😂I think to start it'd be good enough to just serialize to
String
since presumably on parse the client code should know if it wants to cast to decimal (and obvsly TOML doesn't spec a decimal type); though i guess it wouldn't be too hard to add some logic + flag to.parser.Parser._parse_number()
?The text was updated successfully, but these errors were encountered: