TOML support #45
luancarvalhomartins
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Background
PEP 680, proposing the adding of a TOML parser to the Standard Library was accepted. Originally PyAutoFEP used ConfigParser because it's simple and available. JSON is much less human-readable. YAML can be quite complex, requires an external library, and I am not sure if it's widespread. TOML feels quite simple and readable and looks a lot like and ini file.
tomllib
addition to standard lib will likely boost its usebase and provide a solid implementation. One of main inconveniences of ConfigParser is that returns everything as a string, so that PyAutoFEP has a parser to detect types. While for, eg, floats and ints, this is no problem, for dicts and lists it is quite often a problem, forcing users to write proper Python syntax. TOML would solve (elegantly) this issue.TL;DR: a TOML parser will be added to default Python libs, it's simple, readable, and better than regular ini.
Idea
I'm suggesting to add support for TOML as configuration input. It would, at first, be supported together with
.ini
files, but maybe reading files with ConfigParser gets deprecated and removed. I suggest using the reference implementation,tomli
(https://github.com/hukkin/tomli, available in conda-forge), then, eventually, rename imports totomllib
(see PEP 680 for more info).A particular point is that for some options, PyAutoFEP allows a filename to be passed, which, in turn, is read and parsed. In general, these files are expected to have a simpler syntax, sometimes custom (generally, a
key = value
per line syntax). Maybe, these files, is provided could all be taken as TOML also (sure, using a file will be non-mandatory).Cons
.toml
. Later on, this can be changed.Pros
process_user_input.py
)Time frame
Mid. I wouldn't work on this before committing charged perturbation code at least.
Beta Was this translation helpful? Give feedback.
All reactions