FreeTAKTeam/DigitalPy

Python 11 features we can use

Closed this issue · 3 comments

@nam

Actually there have been a number of modules that support parsing of toml files for a number of years. Sort of interesting/nice to see that there is one for the standard Python classes. This will be pretty straight forward to integrate into MainConfig. The biggest question becomes the order of precedence (i.e. does YAML override TOML or does TOML override YAML). Although maybe it should be structured so that once one form is found the other is ignored.

Although the downside is if using tomllib becomes a requirement, then it becomes nearly impossible to run on anything but Python 3.11. Most of the distributions out there are ranging between Python 3.9 and Python 3.10. This can pose installation problems for the greater community as a whole.

BTW I can certainly see dropping official support for Python 3.8. I can not think of any distribution out there that is still shipping with Python 3.8.

We can support both formats. There are a couple of options here:

  1. YAML config is processed first and then the TOML config would be processed. (TOML overrides YAML)
  2. TOML config is processed first and then the YAML config would be processed. (YAML overrides TOML)
  3. Check for YAML, process and ignore TOML. If YAML not found, process TOML.
  4. Check for TOML, process and ignore YAML. If TOML not found, process YAML.

The one thing that the TOML format does not do for us is make it easy to write out a config file. So if we wanted to save the internal state of the configuration we would have to write our own routines that would produce the TOML configuration file. But then even with YAML we still have to prepare all the data before it could be written to a file.