Skip to content

Use tomli instead of the toml package by default#185

Merged
riley-harper merged 2 commits intov4-devfrom
use_tomli
Mar 6, 2025
Merged

Use tomli instead of the toml package by default#185
riley-harper merged 2 commits intov4-devfrom
use_tomli

Conversation

@riley-harper
Copy link
Copy Markdown
Contributor

This is work for #45 and should close that when this is merged to main.

configs.load_conf_file() now uses the tomli package instead of toml by default. toml has some bugs and isn't compliant with TOML v1.0's spec. So swapping to tomli, and from there eventually tomllib in the standard library, seems to be the way to go. We'll need to be on Python 3.11+ before we can import tomllib.

For backwards compatibility, load_conf_file() has the use_legacy_toml_parser argument. This should help give users (and us at ISRDI!) a longer on-ramp to using the new TOML parser. It's easy to accidentally depend on some bugs in the previous parser in config files.

To support backwards compatibility, there is a "use_legacy_toml_parser"
argument. Setting this tells load_conf_file() to use the toml library.
@riley-harper riley-harper merged commit d9d43cd into v4-dev Mar 6, 2025
6 checks passed
@riley-harper riley-harper deleted the use_tomli branch March 6, 2025 19:51
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

Successfully merging this pull request may close these issues.

1 participant