-
-
Notifications
You must be signed in to change notification settings - Fork 402
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
Replacement for cell magic with tab-completion #3173
Conversation
Annoyingly, the signature |
Looks great to me; thanks for seeing this through! Finally, we can have (nearly) everything we want! |
@philippjfr I've ticked off 'Check set_current_backend is used correctly throughout.' having checked that I decided not to replace all the places where |
Sounds good. |
I decided I might as well add tab-completion to |
Sounds good, although I've not used hv.output myself. Unless you object it would also be good to fix the error message when applying options when no backend has been imported, e.g. when running this:
you currently get this useless error:
Would be nice to put an informative error message in |
Another thought I just had is that we are reasonably close to being able to validate the option values early. My
And once holoviz/param#300 is merged it'll be easy to do the same for plot options. I think that could be really useful, even if it isn't enabled by default (at least at first). |
Presumably we can then also not just validate the option values, but also tab complete them and show them in the help? |
That only works for certain options, so at least as a first cut this seems like too much complexity for not that much gain. |
@philippjfr I added a unit test in 79950f6. I'm not entirely happy with it but maybe it will do? |
@philippjfr I would like to see this PR merged so we can start testing it (and you could try |
Was hoping to see a few more unit tests for the new accepted |
That's my only review comment really. |
That is a good idea, I'll add a few more unit tests along those lines. |
Work in progress to address #3095. I'm mostly happy with this approach, illustrated here:
Notes:
%%opts
unless you useclone=False
. The magics set options on the displayed object, not a clone of it.%opts Curve (color='k')
:%%opts Curve (color='k')
:opts
can now tab-complete all possible options if you only use keywords, returning anOption
object.Option
objects have been enhanced with improved validation and reprs (and can now take something likeCurve.Group.Label
as a key.opts
entries do not exist until a backend is loaded..options
as you can no longer setbackend
as a positional argument.TODO:
set_current_backend
is used correctly throughout.opts
class docstring so it isn't clobbered.Decisions to make [We can address these in the docs update PR]:
opts
available in the namespace of examples? (I vote yes)Option
objects (I thinkoptions
isn't bad but a bit long)Options
now it is more user facing than before? i.e make some methods private? Should we document any of the methods/properties at all? Are they useful (e.g thecyclic
predicate?)