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

Clean up docstrings to match Sphinx expectations #237

Open
joefowler opened this issue May 23, 2023 · 3 comments
Open

Clean up docstrings to match Sphinx expectations #237

joefowler opened this issue May 23, 2023 · 3 comments

Comments

@joefowler
Copy link
Member

Original report by Joseph Fowler (Bitbucket: joe_fowler, ).


The make doctest step that auto-generates documentation is generating 1500+ lines of errors and warnings, and the resulting docs (https://oneilg.bitbucket.io/mass/manual_autodoc.html#mass.LineFitter for example) have spacing that looks pretty stupid. Clearly, we are using Sphinx wrong.

At https://sphinx-rtd-tutorial.readthedocs.io/en/latest/docstrings.html there’s advice about how to use VS Code to auto-generate a skeleton docstring.

If we are going to auto-generate documentation and deploy it, then we should really use the correct form. This is a huge project! I understand. Perhaps there are tools to help make it easy?

@joefowler
Copy link
Member Author

Original comment by Joseph Fowler (Bitbucket: joe_fowler, ).


See the VS Code plugin “autoDocstring” to generate compatible skeletons. I have a branch showing that this seems to work, though it will be a ton of work to fix all the error/warnings. Not sure whether it’s worth it….

@joefowler
Copy link
Member Author

Original comment by Joseph Fowler (Bitbucket: joe_fowler, ).


Discussed with @{557058:9524f6a0-ef9f-4466-b913-d04e51ff9093} today. We hate the native Sphinx docstring format, with all the ugly :param and :type clutter that makes a string hard to read in the REPL. We prefer the numpydoc format, which is close to what we were already doing. However! It will require Sphinx to have some kind of Napoleon extension.

  • Add this extension
  • Try some docstrings in that format. (BTW, you can set up your VS Code autoDocstring package to use numpydoc as its format. That was obviously a requirement here.)

@joefowler
Copy link
Member Author

Original comment by Joseph Fowler (Bitbucket: joe_fowler, ).


See https://numpydoc.readthedocs.io/en/latest/format.html for full description of the format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant