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

Ability to deprecate or version config options #1879

Open
kosack opened this issue Apr 13, 2022 · 0 comments
Open

Ability to deprecate or version config options #1879

kosack opened this issue Apr 13, 2022 · 0 comments

Comments

@kosack
Copy link
Contributor

kosack commented Apr 13, 2022

Please describe the use case that requires this feature.

Options in config files change between ctapipe versions, so it would be nice to have a way to do the following

  1. mark a config option as deprecated with a message explaining why or what option to use instead if the parser encounters it
  2. be able to attach some metadata to config files, like the version used to generate them (which is already written in comment form in allow YAML and TOML config files and multiple configs #1856) to also be able to check if the format is compatible.

Everything still works fine without these, as traitlets validates all config options, but with this it makes the user experience a bit better as more useful messages can be generated.

Describe the solution you'd like

Just adding a deprecated field to the trait metadata might work:

some_option = Int(default=0, help="some int").tag(
    config=True, 
    deprecated="use other_option instead"
)

Then just need code to look for them and print out warnings.

for the version metadata, we could create a blank Component for that called Metadata (or ctapipe or somthing) , with traits that get read when any Tool is created, e.g.:

Metadata:
     min_ctapipe_version: 0.11

DataWriter:
    ...
@maxnoe maxnoe changed the title Ability to deprecate or version config optons Ability to deprecate or version config options Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant