🌐
GitHub
github.com › realpython › python-guide › blob › master › docs › writing › documentation.rst
python-guide/docs/writing/documentation.rst at master · realpython/python-guide
You can configure it with commit hooks to your source repository so that rebuilding your documentation will happen automatically. When run, Sphinx will import your code and using Python's introspection features it will extract all function, method, and class signatures.
Author: realpython
🌐
Ubc-dsci
ubc-dsci.github.io › reproducible-and-trustworthy-workflows-for-data-science › lectures › 900-functions-in-python.html
56 Defining functions in Python – Reproducible and Trustworthy Workflows for Data Science
Note that functions in Python are objects. Default values can be specified in the function definition: def math_two_numbers(x, y, operation = "add"): if (operation == "add"): return x + y else: return x - y ... Function documentation is extremely useful at both the time of function creation/development, as well as at the time of function usage by the user.
Discussions

Is there a program to help you document Python functions?
I use this extension in VS Code More on reddit.com
🌐 r/Python
56
247
September 17, 2020
python - How to document a method with parameter(s)? - Stack Overflow
How to document methods with parameters using Python's documentation strings? PEP 257 gives this example: def complex(real=0.0, imag=0.0): """Form a complex number. Keyword More on stackoverflow.com
🌐 stackoverflow.com
What are your preferred conventions for documenting python code?
Module docstrings. I don't think I've ever worked with someone else who writes them. Open up a file for the first time, see 30 lines of imports and a bunch of functions that call each other, the file name is generic and provides no context. This tier of missing documentation is really painful. Just explain what should be used outside the module, specific terminology used here and how things link together. I'm tired of building up the design in my mind from all the implementation bits. More on reddit.com
🌐 r/Python
20
22
December 7, 2022
Deploy Python Azure Function with Code from GitHub Repo using Terraform

I'm assuming you're running your TF locally. If so - https://www.terraform.io/docs/provisioners/local-exec.html should do whatever you need if you're also cloning and publishing locally. If you're using something like Azure Devops or Jenkins, it'll probably still work, but you might have a hoop or two to jump through.

More on reddit.com
🌐 r/AZURE
1
1
August 1, 2020
🌐
GitHub
github.com › topics › python-docs
python-docs · GitHub Topics · GitHub
Universal Python documentation tooltips - Works with 500+ Python symbols! Get instant documentation when hovering over any Python keyword, function, or library.
🌐
Python Data Science Handbook
jakevdp.github.io › PythonDataScienceHandbook › 01.01-help-and-documentation.html
Help and Documentation in IPython | Python Data Science Handbook
One of the most useful functions ... type of documentation and search that will help them do their work effectively. While web searches still play a role in answering complicated questions, an amazing amount of information can be found through IPython alone. Some examples of the questions IPython can help answer in a few keystrokes: How do I call this function? What arguments and options does it have? What does the source code of this Python object look ...
🌐
GitHub
github.com › topics › python-function
python-function · GitHub Topics · GitHub
📖️🐍️💬️ Reserved Python function reference "its" man from Monty Python. Documentation repository.
🌐
GitHub
github.com › kwaldenphd › python-functions
GitHub - kwaldenphd/python-functions: Functions in Python (Elements of Computing I, University of Notre Dame) · GitHub
Answer to this question includes program + comments that document process and explain your code. Q2C: What parts of the program were you able to get working? Where did you run into challenges? ... We can add comments to a function definition by including a docstring under the function header. ... As we've learned previously, single-line comments in Python are declared using the # symbol, and multi-line comments in Python are declared using the ''' symbol.
Forked by 3 users
Languages: Jupyter Notebook
🌐
Readthedocs
pygithub.readthedocs.io › en › latest › introduction.html
Introduction — PyGithub 0.1.dev50+g9152817c2 documentation
https://github.com/gomesfernanda/some-github-metrics - Python functions for relevant metrics on GitHub repositories
🌐
GitHub
github.com › topics › python-documentation
python-documentation · GitHub Topics · GitHub
Extract markdown from Python source file comments and outputs structured documentation & README file.
Find elsewhere
🌐
GitHub
gist.github.com › lneeraj97 › 8f617b1f67434b11a9f491f8b202eda9
Python documentation standards (Notes) · GitHub
The class constructor parameters should be documented within the __ init __ class method docstring. Individual methods should be documented using their individual docstrings.
🌐
Python How Tos
campbell-muscle-lab.github.io › howtos_Python › pages › documentation › best_practices › best_practices.html
Documentation Best Practices - Python How Tos
The Parameters section is very important and should be included any time parameters are passed to the function. Document all parameters in this section with the following format:
🌐
Real Python
realpython.com › documenting-python-code
Documenting Python Code: A Complete Guide – Real Python
July 17, 2026 - In this section, you’ll learn about docstrings and how to use them for documentation. This section is further divided into the following sub-sections: Docstrings Background: A background on how docstrings work internally within Python · Docstring Types: The various docstring “types” (function, class, class method, module, package, and script)
🌐
Readthedocs
sphinxcontrib-napoleon.readthedocs.io › en › latest › example_google.html
Example Google Style Python Docstrings — napoleon 0.7 documentation
_Google Python Style Guide: http://google.github.io/styleguide/pyguide.html """ module_level_variable1 = 12345 module_level_variable2 = 98765 """int: Module level variable documented inline. The docstring may span multiple lines. The type may optionally be specified on the first line, separated by a colon. """ def function...
🌐
Reddit
reddit.com › r/python › is there a program to help you document python functions?
r/Python on Reddit: Is there a program to help you document Python functions?
September 17, 2020 -

I just finished a Python project and now want to go back and document each function while it is still fresh in my head. Is there a program that will scan your code for functions that don't have a doc-string and then interactively ask you to:

  • describe the function

  • document each parameter

  • document the return value

It would then create a doc-string for you that you could simply copy/paste into your code.

Thanks.

Top answer
1 of 9
317

Since docstrings are free-form, it really depends on what you use to parse code to generate API documentation.

I would recommend getting familiar with the Sphinx markup, since it is widely used and is becoming the de-facto standard for documenting Python projects, in part because of the excellent readthedocs.org service. To paraphrase an example from the Sphinx documentation as a Python snippet:

def send_message(sender, recipient, message_body, priority=1) -> int:
   """
   Send a message to a recipient.

   :param str sender: The person sending the message
   :param str recipient: The recipient of the message
   :param str message_body: The body of the message
   :param priority: The priority of the message, can be a number 1-5
   :type priority: integer or None
   :return: the message id
   :rtype: int
   :raises ValueError: if the message_body exceeds 160 characters
   :raises TypeError: if the message_body is not a basestring
   """

This markup supports cross-referencing between documents and more. Note that the Sphinx documentation uses (e.g.) :py:attr: whereas you can just use :attr: when documenting from the source code.

Naturally, there are other tools to document APIs. There's the more classic Doxygen which uses \param commands but those are not specifically designed to document Python code like Sphinx is.

Note that there is a similar question with a similar answer in here...

2 of 9
132

Based on my experience, the numpy docstring conventions (PEP257 superset) are the most widely-spread followed conventions that are also supported by tools, such as Sphinx.

One example:

Parameters
----------
x : type
    Description of parameter `x`.
🌐
GitHub
github.com › python › docsbuild-scripts
GitHub - python/docsbuild-scripts: Scripts for building the documentation on docs.python.org · GitHub
This repository contains scripts for automatically building the Python documentation on docs.python.org.
Author: python
🌐
Python-sprints
python-sprints.github.io › pandas › guide › pandas_docstring.html
pandas docstring guide — Python documentation
To display only the last component of the linked class, method or function, prefix it with ~. For example, :class:`~pandas.Series` will link to pandas.Series but only display the last part, Series as the link text. See Sphinx cross-referencing syntax for details. ... def add_values(arr): """ Add the values in `arr`. This is equivalent to Python `sum` of :meth:`pandas.Series.sum`. Some sections are omitted here for simplicity.
🌐
Google
google.github.io › styleguide › pyguide.html
Google Style Guides | Style guides for Google-originated open-source projects
Be sure to use the right style for module, function, method docstrings and inline comments. Python uses docstrings to document code. A docstring is a string that is the first statement in a package, module, class or function. These strings can be extracted automatically through the __doc__ ...
🌐
DeepDocs
deepdocs.dev › home › master python function documentation with effective docstrings
Master Python Function Documentation with Effective Docstrings | DeepDocs
October 29, 2025 - You can dive deeper into this idea in our post on why CI/CD still doesn’t include continuous documentation. The goal is simple: stop relying on human memory. We can use tools that plug directly into our development workflow to make sure the code and the docs never fall out of sync. Tools like DeepDocs monitor your GitHub repository. When you modify a function, it instantly sees that the docstring no longer matches the code.
🌐
The Hitchhiker's Guide to Python
docs.python-guide.org › writing › documentation
Documentation — The Hitchhiker's Guide to Python
You can configure it with commit hooks to your source repository so that rebuilding your documentation will happen automatically. When run, Sphinx will import your code and using Python’s introspection features it will extract all function, method, and class signatures.