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

DOC Fix 'size' sphinx warnings. #19577

Closed
wants to merge 1 commit into from
Closed

Conversation

cmarmo
Copy link
Contributor

@cmarmo cmarmo commented Jul 28, 2021

This pull request partially addresses #13114, fixing the sphinx warnings related to single back-quoting size.

@mattip
Copy link
Member

mattip commented Jul 28, 2021

It is a bit tricky, since size as a parameter is OK so each case must be carefully examined.

@cmarmo
Copy link
Contributor Author

cmarmo commented Jul 28, 2021

It is a bit tricky, since size as a parameter is OK so each case must be carefully examined.

... sorry I don't understand: the parameter names do not produce a sphinx warning because they are not back-quoted. I have only changed the single quote to double quote where the warnings were rising ... do you mind clarifying what I am missing? Thanks.

@rossbar
Copy link
Contributor

rossbar commented Jul 28, 2021

sorry I don't understand: the parameter names do not produce a sphinx warning because they are not back-quoted. I have only changed the single quote to double quote where the warnings were rising ... do you mind clarifying what I am missing? Thanks.

The problem is that single backticks around parameter names is correct according to the numpydoc docstring standard which is used not only by numpy but many other projects as well. The root of the problem is that the single backticks around parameter names conflicts with the default role from sphinx itself. This is a common problem which is touched on a bit in #18879 and especially numpy/numpydoc#323.

IMO this should be fixed in numpydoc itself. There was an attempt to solve the collision in backtick semantics in numpy/numpydoc#303 which had some components that I think were headed in the right direction. The way I would try to solve this problem would be to define a new numpydoc configuration parameter (say numpydoc_parameter_role) and apply it to parameters in numpydoc-formatted docstrings to preempt the collision with the default sphinx role. I plan on taking a stab at this at some point but if someone else is interested in picking it up I'm happy to review! All this is a bit of a tangent for this PR but long story short is that I don't think the proposed changes here are the right way to solve the problem as a more comprehensive fix is needed.

@cmarmo
Copy link
Contributor Author

cmarmo commented Jul 28, 2021

Thanks @rossbar for the clarification. I'm closing this then.

@cmarmo cmarmo closed this Jul 28, 2021
@cmarmo cmarmo deleted the size-warnings branch July 28, 2021 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants