-
Notifications
You must be signed in to change notification settings - Fork 207
MRG: Fix warning #195
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
MRG: Fix warning #195
Conversation
I seem to remember the eval is there when you want to pass this parameter on the command-line via |
I also seem to remember |
I think both of those should work since there is the |
I never get this warning unless using 'make html-noplot'. Indeed it come from overriding the default values from the command line call of sphinx-build as it does not do a good job assigning types, it actually can't as command line input is strings. For I don't like the idea of this PR of putting quoting the default value to avoid the warning. If this happen because we are overriding the configuration on the command line then is pretty sure the the person making the call knows what he is doing. On the contrary having the default value as a string looks band and I'm unsure if that will inspire confusion. For people willing to have a permanent change in their For me I'm fine with the warning. But I will indeed put an extra |
Yes, we use this standard option a lot, both in CircleCI automated builds for PRs and ask contributors to do it locally because our full build takes forever.
I don't think that packages (this one included) should emit warnings when functionality is used in standard, correct ways. It promotes ignoring warnings, which is bad practice.
Yeah, this the downside of this change. My understanding is that the tradeoff is essentially between having an effect on all users correctly using the package (a warning; current behavior) for an effect that is internal to sphinx-gallery code/maintainers (string default; proposed behavior) that runs a small risk of temporarily confusing devs -- although perhaps that could be fixed by an appropriate/better comment?
How do you mean? To me this is just an internal aesthetic |
With permanent change I mean defining your defaults. Sphinx-Gallery defaults to sphinx_gallery_conf ={
...
'plot_gallery':False} In that way your default in not executing the examples and if that is your most used that may better be your default.
I do agree on that, I did scan Sphinx code to see what it does to the config values, but I could not see a good way for it to take arguments of the command line with a type. |
Ahh, so customize it with In any case I'm not sure how this ability to change the default affects whether or not we should change the default inside
So you're okay with this change, then? Should I improve the comment somehow? |
ping @Titan-C any thoughts? I still get these warnings on every run. |
This one is still good to go from my end |
(if @Titan-C you are convinced) |
@Eric89GXL how does this change what users need to do? At all? |
It doesn't change anything at the user end, just makes it so a warning goes away that otherwise always shows up, 3rd line of any
|
in that case I'm +1 on this. Maybe add a "users should still use True" in the comment so that it doesn't confuse folks that happen to stumble upon the code. |
(but I'll defer to @Titan-C since y'all were discussing this prior to me jumping in) |
I think that this is a case of "practicality beats purity". What are the drawbacks? This PR seems to fix the problem quite simply. |
The only drawback I see is that devs might be confused why a string value is given instead of a standard bool, but there is a comment in the code for this reason. |
The only drawback I see is that devs might be confused why a string value is
given instead of a standard bool, but there is a comment in the code for this
reason.
Agreed. Maybe the comment can be made even more clear: "We use a string
here rather than simply the Python boolean 'True' as it avoids a warning
about unicode when controlling this value via the command line switches
of sphinx-build".
|
@GaelVaroquaux done |
@Titan-C : what do you think? |
This issue does bug me, but I have not found and elegant solution to it in
the last months. The main problem is consistency. As you see from the
message the True string is only for the plot gallery option, the rest are
Python booleans. But command line options are passed as strings. As I wrote
earlier
#195 (comment)
We might need to include an eval statement for all the command line options.
I'll just go with "practicality beats purity" for now, and take the string
as default to avoid the warning as no better solution came to my mind. The
command line options are to the knowledgeable who can understand the
warning when he changes the defaults.
+1
|
As there seems to be a consensus here, I am merging this. Thanks! |
Without this change, I always get this warning:
I don't love this fix. I assume only bool values should be allowed, but there is an
eval
later in the code that looks like it's meant to accommodate string values, so this might actually be a correct workaround.