Wrapping up Cookiedozer

We are about to finish this tutorial on how to create a Cookiecutter template for an Android application running Kivy. If you haven’t checked out Create Your Own Cookiecutter and Extending Cookiedozer yet, please have a brief look into these articles as this post draws on them.

The current project structure of Cookiedozer is as follows:


Set up Sphinx

Following the instructions of the ReadTheDocs tutorial, we are going to create a docs folder at the template level.

Quickstart

Sphinx comes with a very handy CLI tool to set up docs, namely sphinx-quickstart.

We can simply feed the Cookiecutter variables to it. Feel free to change the values according to your needs.

Index.rst

Sphinx creates an index.rst file inside of the source folder which should look similiar to the following:

Adding more pages to the docs is fairly easy. You just need to create another rst file and insert it to the table of contents respectively.

Readme and App Docs

In this particular case I reuse the readme which we created in the course of Create Your Own Cookiecutter as well as a separate file for our basic application.

Including the readme is very straight-forward. Simply add the following code.

The actual content of the app file is going to be generated from the python source code. To tell sphinx what to include edit {{cookiecutter.repo_name}}.rst as follows:

Next up we update index.rst accordingly. In addition to the newly created pages we add the project’s short description using Cookiecutter.

Package Location

There is one thing left to do. The autodoc extension needs to know where to find our package. It turns out conf.py  already features an according example. We need the sys path to contain the folder two levels above the source folder.

Google Style Docs

As you might remember from the last part of this tutorial I used a doc string syntax in our tests module which is slightly different from the standard sphinx docs. Generally I prefer this over the regular syntax as it is way more readable and requires less boilerplate, but in this particular case I stick to the standard as I want the Kivy docs to seamlessly integrate with my docs.

At the end of the day it’s totally up to you if you want to use it for your project.

Feel free to consult the examples at http://sphinx-doc.org/latest/ext/example_google.html. Please note that you need to install an extension, namely Napoleon, for sphinx to understand Google Style docs.


That’s it for the documentation part. On the next page of this tutorial we are going to set up Buildozer as well as a MAKEFILE.