Closed mgorny closed 1 year ago
Thanks for the PR. I think it's best to use tomlkit for Python < 3.11.
Thanks for the PR. I think it's best to use tomlkit for Python < 3.11.
toml
and tomli
are the same package, so using it guarantees exactly the same behavior across Python versions. I'm not sure if tomlkit
doesn't have some slight behavior differences.
I don't think yq will be using tomli/tomli-w because I think splitting the read and write functionality into separate packages was a mistake.
I agree we should import tomllib and use it on Python 3.11+. I also see a number of issues on the old toml package repo but it's unclear to me how severe they are.
This PR has merge conflicts and needs to be split into at least two: one for using tomllib on 3.11+ and one for replacing the toml dependency. I have to warn you, I'm not sure what to do about the latter so I'm not sure what I can accept there.
I don't think yq will be using tomli/tomli-w because I think splitting the read and write functionality into separate packages was a mistake.
I agree we should import tomllib and use it on Python 3.11+. I also see a number of issues on the old toml package repo but it's unclear to me how severe they are.
These two statements conflict with each other. tomllib
is read-only, so you need to use an external writer. If you require a reader+writer in a single package, then using tomllib
makes no sense.
Thanks for clarifying. That's... not what I expected. I never imagined someone would commit a read-only parser to the standard library.
Thanks again for the PR. Due to the misguided decision to split up the parser and serializer, I don't expect that yq will be using the standard library tomllib/tomli-w functionality. Instead we will try to move forward with tomlkit.
Replace the use of the unmaintained
toml
package with the modern trinity: built-intomllib
module for reading TOML in Python 3.11+,tomli
for reading TOML in older Python versions andtomli-w
for writing TOML in all Python versions. This ensures correct TOML 1.0 support that the oldtoml
package lacks.