Skip to content

Commit

Permalink
Overhaul configuration system (#729)
Browse files Browse the repository at this point in the history
* 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.

* Address review comments.  Run format_source.sh
  • Loading branch information
tskisner authored Jan 27, 2024
1 parent 156b9c8 commit 280e252
Show file tree
Hide file tree
Showing 34 changed files with 2,089 additions and 1,856 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def readme():
"psutil",
"h5py",
"pshmem>=0.2.10",
"pyyaml",
"ruamel.yaml",
"astropy",
"healpy",
"ephem",
Expand All @@ -310,7 +310,7 @@ def readme():
"ipywidgets",
"plotly",
"plotly-resampler",
]
],
}
conf["packages"] = find_packages(
"src",
Expand Down
3 changes: 2 additions & 1 deletion src/toast/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ install(FILES
mpi.py
timing.py
traits.py
config.py
trait_utils.py
job.py
pixels.py
pixels_io_healpix.py
Expand Down Expand Up @@ -163,6 +163,7 @@ install(DIRECTORY
)

# Process the sub directories
add_subdirectory(config)
add_subdirectory(io)
add_subdirectory(accelerator)
add_subdirectory(tests)
Expand Down
3 changes: 2 additions & 1 deletion src/toast/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
raise ImportError("Cannot read RELEASE file")


from .config import create_from_config, load_config, parse_config
from .config import load_config, parse_config
from .data import Data
from .instrument import Focalplane, GroundSite, SpaceSite, Telescope
from .instrument_sim import fake_hexagon_focalplane
Expand All @@ -95,4 +95,5 @@
from .observation import Observation
from .pixels import PixelData, PixelDistribution
from .timing import GlobalTimers, Timer
from .traits import create_from_config
from .weather import Weather
Loading

0 comments on commit 280e252

Please sign in to comment.