-
Notifications
You must be signed in to change notification settings - Fork 4
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
Clickify cleanup #359
Clickify cleanup #359
Conversation
Run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems ok to me. It will require handling optional lists differently in pfb but that should be doable. More worrying is the numpy dependency here
Line 18 in 36d1abb
numpy = "^1.20" |
Not sure if this relates to the current setuptools issues but even with setuptools[core] I get the following conflicts
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
codex-africanus 0.4.1 requires numpy<3.0,>=2.0, but you have numpy 1.26.4 which is incompatible.
dask-ms 0.2.23 requires numpy>=2.0.0, but you have numpy 1.26.4 which is incompatible.
What does stimela use numpy for anyway?
Oh fsck numpy, I was only using it in one place, and I can work around without it. I've taken the dependency out, try again.
Well nothing's changed there -- it seems that click was passing optional lists as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to be working for me. Empty lists are still parsed as None
for some reason though so this does not really change anything in pfb. I guess it's because I don't have a repeat policy set. Note I will be mostly AFK until I get back from leave in early Jan
OK well if @Athanaseus approves, I'll merge this and do a point release, so he can get his breizorro PR in as well. |
@landmanbester please check if this works with PFB.
I've removed the
pass_missing_as_none
logic fromclickify_parameters()
, as upon closer investigation, this is what click now does always and anyways, except when dealing with some multiply-valued parameters (that is, Lists with a policy of repeat: repeat, in which case a missing parameter is passed as an empty tuple). I don't see any way to change this behaviour. The new code checks for UNSET defaults, and doesn't give click a default value for them, which results in aNone
being passed to the callable in the absence of the parameter. I think this behaviour is harmless and unlikely to trip us up, except when you have something perverted likewith a schema that doesn't mention the default from the function signature:
...which results in
func(a=None)
when the command-line doesn't specify--a
. This is because neither stimela nor click knows anything about the signature actually, and has no choice but to trust what the schema says.Note that
pass_missing_as_none
is still honoured by stimela itself when invoking a cab (i.e. is the difference between having nothing in**kw
, or having aNone
value in**kw
). Given your love for**kw
, I think this is what you expect, right?