Member-only story

Auto-generate documentation for a Python project

tjtharrison
6 min readAug 16, 2023

--

In this article we’re going to be covering how to setup a GitHub workflow to automatically generate documentation for a Python application.

Why?

Documentation is important for users and developers of any project to know how to interract with functions. When looking at a project for the first time it’s useful to be able to see all functions grouped together in a single location with details on how to use them.

Documentation can become difficult to maintain if you are doing so by hand, so having this programatically generated will save you a great deal of hassle over time.

How?

We are going to be using a few different tools and practices to achieve this automatic documentation, we’ll go through them quickly before diving into each.

  • Python — We’ll be generating documentation for a small python application
  • Google style docstrings — We’ll be using Google style docstrings in our Python functions in order to provide the details for the documentation tools.
  • mkgendocs — mkgendocs will be used to parse the Python files and generate the documentation
  • mkdocs — mkdocs will be used to serve our documentation
  • GitHub Workflow — Will be used to bring it all together and automate the documentation.

--

--

tjtharrison
tjtharrison

Written by tjtharrison

DevSecOps | Security | Infrastructure

No responses yet