caracal-pipeline / stimela

Stimela 2.0
GNU General Public License v2.0
5 stars 3 forks source link

Non str choices in clickify_parameters #330

Open landmanbester opened 2 weeks ago

landmanbester commented 2 weeks ago

Ran into an issue where click interprets all choices as strings. According to the docs

image

so even though the individual choices have the correct datatype in clickify_parameters here

https://github.com/caracal-pipeline/stimela/blob/1c6a973605d611ae6908028ca8c588fe6de2da4b/scabha/schema_utils.py#L259

they still get parsed as strings. This is probably easy enough to handle on the user side but thought I would document it here for posterity

o-smirnov commented 1 week ago

That's a bit of an annoying click limitation. I suppose we could work around it by adding a custom click validator to the option, rather than using click.Choice. All depends on motivation levels...

JSKenyon commented 1 week ago

I was looking at Typer. I quite like the way it uses Python type annotations. Not sure if it would be a viable alternative to click. I have been thinking about CLIs again because at some point I want to figure out how to simplify the cult-cargo + QC process.

o-smirnov commented 1 week ago

Could be an option! We could consider a typerify_parameters function alongside the current clickify_parameters one. In the Stimela view, it's just a convenience function for the developer, no reason why we can't have two.