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

Invalid options should warn instead of preventing display #201

Closed
jlstevens opened this issue Jul 5, 2015 · 5 comments
Closed

Invalid options should warn instead of preventing display #201

jlstevens opened this issue Jul 5, 2015 · 5 comments
Labels
type: feature A major new feature

Comments

@jlstevens
Copy link
Contributor

Now that we can switch backends, there is a problem with how invalid options supplied to the %opts magic are handled (actually this affects how OptionTrees are processed in general). Currently, an HTML message is generated to inform the user that a supplied option was invalid.

Now, if the backend is changed, the valid style/plot options are also likely to change. This means, that many plots won't display at all due to the invalid option messages. The proposed solution is to ignore the options that are invalid, generate a warning about the options which were ignored and still show the available display output.

Note that this issue mostly applies to style options: I think we should highly recommend that plot options stay as consistent as possible between backends as we implement them!

@jlstevens jlstevens added the type: feature A major new feature label Jul 5, 2015
@jlstevens jlstevens changed the title Invalid options should warn and should not prevent display output Invalid options should warn instead of preventing display Jul 5, 2015
@jbednar
Copy link
Member

jbednar commented Jul 5, 2015

I strongly support this change. It would be good if the message listing the ignored options could include a statement of how to use the logging module to supress the warnings, in case people want to happily put in hints that are useful for some backends but not known for others.

I agree that it would be good practice to support the same plot options (and to clarify that the principle is not just highly recommended (which sounds like it's up to external users to ensure) but is something that is true as far as we can make it (i.e., it's up to the backend maintainers)).

@jlstevens
Copy link
Contributor Author

I've finally gotten round to implementing this improvement in dc66a8b.

As typical when working with OptionTrees, even this simple change exposed some incorrect behavior that was fairly tricky to debug (namely lack of keyword validation when building custom option trees). That particular issue has now been fixed in 58b8a26.

It would be good if the message listing the ignored options could include a statement of how to use the logging module to supress the warnings, in case people want to happily put in hints that are useful for some backends but not known for others.

I agree this would be a nice feature but I don't think the logging module will offer much granularity - if you match on the start of the warning message (i.e 'Invalid option ...') you'll suppress all such warnings. Any more specific string matching is bound to be extremely brittle.

This suggests that skip_and_warn is not as flexible as it should be and should be split into two flags which I'll do now...

@jlstevens
Copy link
Contributor Author

Since 6bc4543 there are now two boolean parameters on Options (only settable at the class level to avoid limiting the set of possible keywords): skip_invalid and warn_on_skip. The former is now enabled by default so that invalid keywords are skipped instead of raising an exception. The latter is useful to disable all such warnings if you are switching backends a lot:

hv.Options.warn_on_skip=False

I think I can now close this issue now the suggested feature is implemented.

@jbednar
Copy link
Member

jbednar commented Aug 11, 2015

Sounds great, thanks! I'll try it out on various notebooks and reopen the issue if I have problems.

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: feature A major new feature
Projects
None yet
Development

No branches or pull requests

2 participants