ssato / python-anyconfig

Python library provides common APIs to load and dump configuration files in various formats
MIT License
278 stars 31 forks source link

Update toml parser #153

Closed flying-sheep closed 1 year ago

flying-sheep commented 1 year ago

Is your feature request related to a problem? Please describe. The “toml“ project on PyPI is old and unmaintained.

Describe the solution you'd like Use the stdlib’s tomllib on Python 3.11 and tomli on lower Python versions

Describe alternatives you've considered Get uiri to pick up development on toml? Probably no alternatives.

ssato commented 1 year ago

Thanks a lot for letting me know these libs I was not aware of.

I added support of {tomllib, tomli-w}, {tomli, tomli-w} and tomlkit in 4a000c5 .

flying-sheep commented 1 year ago

Great! That for sure fixes the problem with the toml package being essentially unmaintained.

One thing that would be great was if TOML reading capabilities worked on Python 3.11 without tomli-w being installed. Some packages just read config files using anyconfig and don’t write them. Currently, anyconfig assumes that every “Parser” is also a serializer.

Independently, this

https://github.com/ssato/python-anyconfig/blob/4a000c57be426e4f3b46654c087a5309871329d1/setup.cfg#L70-L71

should probably be changed to this

toml =
    tomli; python_version < "3.11"
    tomli-w
ssato commented 1 year ago

Thanks a lot. I applied the fix also.

flying-sheep commented 12 months ago

Great! Will there be a release soonish so it can be used?

ssato commented 10 months ago

Sorry to late reply. I'm now preparing the next release will contain this change and updates.

ssato commented 10 months ago

FYI. I released 0.14.0 contains the fix for this.

flying-sheep commented 10 months ago

thank you for the info, it’s appreciated!