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_KEYin the repo's secrets.
-
Copy the .github Folder:
- Copy the
.githubfolder 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
.pyfiles are in a folder calledsrc, the action should work as is. Otherwise, edit thellm-documenter.ymlfile to change the value of theSOURCE_PATHenvironment 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:
- After every push, you can manually start the action in the github-actions-tab. It will:
- Add docstrings to
.pyfiles that have changed, add typing and lint your files. The changes will be pushed to a new "commented_branch". - Summarize your project, build a Sphinx documentation, and put it in the
docsfolder in a gh_pages-branch.
- Add docstrings to
- After every push, you can manually start the action in the github-actions-tab. It 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 :).
