question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Should docstrings all be valid RST?

See original GitHub issue

I’ve seen http://docs.rigetti.com/en/stable/ which includes some of the API strings via https://github.com/rigetti/pyquil/tree/master/docs/source/apidocs and Sphinx.

Initially assuming you used all the docstrings, I used it as a test case for my flake8 plugin which validates docstrings as reStructuredText markup. This reported various violations. I’ve looked at a sample, but didn’t find any affecting docstrings actually appearing in your documentation.

e.g. Multiple usage of the string |000...00> without slash escaping the pipe, which docutils (and therefore I would expect Sphinx) sees as a malformed inline substitution reference, “Inline substitution_reference start-string without end-string”. I used your example to build a new test case for the flake8 plugin https://github.com/peterjc/flake8-rst-docstrings/commit/ee3b66a0a0451e0034b1ac7eb849bc3f344c7834

I’ve concluded there is some selection (possibly manual curation) for which of your docstrings appear in the documentation, so perhaps only those need to be valid RST (and you may be checking this anyway via sphinx in strict mode using SPHINXOPTS = -W?).

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
peterjccommented, Dec 27, 2019

Quoting that:

As for braket notation, I think that the double backticks or inline math suggestions are the way to go. I’d lean toward double backticks in most situations because we don’t need to be rendering math when it is gratuitous, but I’m sure there will be situations where we are writing out equations where using :math: is more appropriate.

I agree, very pragmatic.

0reactions
karalekascommented, Dec 31, 2019

closed in #1141

Read more comments on GitHub >

github_iconTop Results From Across the Web

Writing docstrings — Sphinx-RTD-Tutorial documentation
The :raises: option is used to describe any errors that are raised by the code, while the :return: and :rtype: options are used...
Read more >
sphinx.ext.autodoc – Include documentation from docstrings
For this to work, the docstrings must of course be written in correct reStructuredText. You can then use all of the usual Sphinx...
Read more >
vim - Embedding reStructuredText in Python docstrings
As the reST syntax should only be applied inside Python doc strings, you have to include them into a syntax cluster (here: @pythonRst...
Read more >
Writing Documentation — openHAB Helper Libraries ...
All classes should have docstrings unless they are private. They should follow the Classes guidelines for content and format, except for the __init__...
Read more >
Documenting Your Project Using Sphinx
For this to work, the docstrings must of course be written in correct reStructuredText. You can then use all of the usual Sphinx...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found