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

Adopt docstring convention #22

Closed
ns-rse opened this issue Jun 26, 2024 · 0 comments · Fixed by #35
Closed

Adopt docstring convention #22

ns-rse opened this issue Jun 26, 2024 · 0 comments · Fixed by #35

Comments

@ns-rse
Copy link
Contributor

ns-rse commented Jun 26, 2024

The Scientific Python Documentation Tutorial recommends using numpydoc formatted docstrings in Python as they work well with Sphinx's autodoc and autosummary extensions.

I appreciate not all Python projects will be scientifically aligned but many would be.

This would encourage the use of Type Hints which code bases benefit from having as there are linters which can check type hints are consistent and correct which in turn reduces the amount of errors that can arise when running code (using Type Hints in examples could easily be a separate issue though).

There is also a convention for adding examples sections to docstrings and these can even form the basis of tests for a package via the standard libraries doctest (and of course pytest supports doctest.

Using Type Hints and adding Examples could easily be their own issues so listing below to facilitate creation of these if it is desirable to do so.

  • Add Type Hints to docstrings for Python examples.
  • Add Examples to docstrings for Python examples.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant