We implement a github actions llm that creates docstrings, typing, linting, and sphinx autodocumenation This was done during coding.waterkant hackathon in Kiel
Since several attendees asked how to set up the workflow and non-existent documentation for a tool that documents for you is amusing but not very helpful, here is a short explanation on how to get this tool working:
-
Generate GROQ API Key:
- The action uses the GROQ API to generate docstrings and summarize the code.
- Generate an API key and save it under the name
GROQ_API_KEY
in the repo's secrets.
-
Copy the .github Folder:
- Copy the
.github
folder from this repo to your project's root folder. Ignore everything else in this repo; the files insrc/
are just there as examples.
- Copy the
-
Configure Source Path:
- If your
.py
files are in a folder calledsrc
, the action should work as is. Otherwise, edit thellm-documenter.yml
file to change the value of theSOURCE_PATH
environment variable to represent your source folder.
env: SOURCE_PATH: your_source_folder
- If they to not already, all your code-folders do also need init.py-files, even if the files are empty. Sphinx-autodoc will ignore them if they don't have one.
- If your
-
Push Changes:
- Whenever you push, the action will:
- Add docstrings to
.py
files that have changed. - Summarize your project, build a Sphinx documentation, and put it in the
docs
folder.
- Add docstrings to
- Whenever you push, the action will:
-
Publish Documentation (Optional):
- If your repo is public, you can make the documentation accessible via GitHub Pages.
-
Profit!
We tried to make the action as non-invasive as possible, we did already encounter some issues with complex return-values and class imports from other modules in one project. The Landing page for the documentation is additionally a bit prone to hallucination since we added it last minute. What we are trying to say is that we do not guarantee anything, a start in documenting is a start though :).