Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhaul configuration system #729

Merged
merged 2 commits into from
Jan 27, 2024
Merged

Overhaul configuration system #729

merged 2 commits into from
Jan 27, 2024

Conversation

tskisner
Copy link
Member

The current configuration system suffers from some challenges, including fragile / special-case parsing of container traits. This work aims to make this area of the code robust and more future-proof:

  • Move config tools into a submodule, extract some things from traits.py.

  • Support arbitrary nested containers, including parsing of those and None values from the commandline. Expand unit tests to included nested containers.

  • Dedicated set of routines for translating back and forth from trait values and strings.

  • Separate file-format code more cleanly from code that just works with the internal config dictionary format.

  • Add support for YAML config files, along with existing JSON and TOML formats.

  • Expand the toast_config_verify script to support loading and migrating old config files to new ones (or for converting between supported formats).

  • Keep support for loading old config files, while printing warnings telling the user to update their configs.

As part of testing these changes, I checked (with toast_config_verify) that existing config files from CMB-S4 DC0 and from S.O. integration tests are loadable (with deprecation warnings).

@tskisner tskisner requested a review from keskitalo January 24, 2024 19:36
Copy link
Member

@keskitalo keskitalo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have been busy! Looks good.

src/toast/config/toml.py Show resolved Hide resolved
src/toast/config/utils.py Show resolved Hide resolved
src/toast/config/utils.py Show resolved Hide resolved
src/toast/config/yaml.py Show resolved Hide resolved
fragile / special-case parsing of container traits.  This work aims to
make this area of the code robust and more future-proof:

* Move config tools into a submodule, extract some things from traits.py.

* Support arbitrary nested containers, including parsing of those and None
  values from the commandline.  Expand unit tests to included nested
  containers.

* Dedicated set of routines for translating back and forth from trait
  values and strings.

* Separate file-format code more cleanly from code that just works with the
  internal config dictionary format.

* Add support for YAML config files, along with existing JSON and TOML
  formats.

* Expand the `toast_config_verify` script to support loading and migrating
  old config files to new ones (or for converting between supported formats).

* Keep support for loading old config files, while printing warnings telling
  the user to update their configs.
@tskisner tskisner merged commit 280e252 into toast3 Jan 27, 2024
6 checks passed
@tskisner tskisner deleted the config_containers branch January 27, 2024 00:43
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.

2 participants