Documenting Source Code in PyCharm
In this part:
PyCharm provides convenient features for creating documentation comments.
Documentation comments in your source code are available for the Quick Documentation Lookup and open for review on pressing Ctrl+Q.
Documentation comments can be created in accordance with the syntax, selected in the
Python Integrated Tools page of the Settings/Preferences dialog, for example,
If this feature applies to a function, PyCharm generates tags, depending on the selected docstring format, for example:
- For reStructuredText:
:paramtags for each parameter declared in the function signature, and
- For epytext:
@paramtags for each parameter declared in the function signature, and
If configured, the documentation
comment stubs can be generated with
When you create additional tags, PyCharm provides code completion that suggests the possible tag names.
PrerequisitesIn the Python files, PyCharm recognizes the documentation comments represented as Python docstrings.
Before you start, make sure that the required docstring format, for example,
reStructuredText, is selected in the
Python Integrated Tools page.
Also note that PyCharm captures custom roles from
When configuring the directory that contains
*.rst files, point to the
Integrated Tools | Path to the directory with *.rst files).