Add code docs generation and deployment to GitHub Pages for A-plus. #1452
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
What?
Add rst files for compiling A+ frontend (Python) code documentation using Sphinx autodoc, and add the workflow to deploy these docs into GitHub pages on each commit to the master branch.
Why?
Since large parts of the A+ Python code is documented using docstrings, it's a waste not to compile this information to a format which is easier to read and follow by clicking on hyperlinks. One can also easily see the source for each method/class (code and docs are linked both ways). Maybe this will also encourage developers to improve the docstring coverage.
How?
First, I created an initial set of rst files using sphinx-apidoc. These files mostly contain definitions for the automodule extension, which finds the pieces of code (at compilation time) to extract documentation from. As this "initialisation" process is only done once, one needs to create new rst files (or edit the new ones) whenever new Python files are added, or new modules are added in the existing files.
Once the set of files is created, sphinx-build is used to produce the actual html (or pdf/whatever) code from it. This build step is ran via a GitHub action so that it runs every time the master branch gets a new commit. After the build is finished, the files are deployed to GitHub Pages, and the code documentation root should be present under https://apluslms.github.io/aplus/. This page can then be linked to the main docs repo, and a similar documentation workflow can be created also for other projects besides a-plus.
Notes:
Testing
Remember to add or update unit tests for new features and changes.
What type of test did you run?
I tested the workflow in my own fork (and branch) of a-plus, so in theory it is possible that something does not work in the a-plus master branch.
The addition of docs should not affect any existing tests. The only changes to actual code in this commit were fixing the docstring list indentation in two Python files. There are still some warnings in the compilation process
Did you test the changes in
Think of what is affected by these changes and could become broken
Translation
Programming style
Have you updated the README or other relevant documentation?
Is it Done?
Clean up your git commit history before submitting the pull request!