Code documentation improves code quality, enhances collaboration, and simplifies the development and maintenance processes. It’s a valuable practice for any software development project.
Components
Comments: short descriptions that contains the ‘why’ a piece of code exists.
Docstrings: descriptions for functions and classes that describe overall utility, arguments and returns.
Annotations: also know as type hints, is the specification of a function’s inputs and outputs data types.
Docs: usually a webpage that summarizes all the functions, classes, workflows and examples.
Docstrings
Annotations
Docs
Once your project have a nice documented structure using the features above, it’s possible to generate a HTML page for your documentation automatically. For this check the Sphinx or the MkDocs libraries.