Skip to content

Commit

Permalink
chore: Update generate_docs workflow to use pydoctor for generating d…
Browse files Browse the repository at this point in the history
…ocumentation
  • Loading branch information
dasunpubudumal committed Aug 23, 2024
1 parent a7166c9 commit b587eb9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
18 changes: 17 additions & 1 deletion .github/workflows/generate_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,27 @@ jobs:
with:
python-version: 3.11

- name: Get latest release tag and version
run: |
LATEST_RELEASE_TAG=$(curl --silent "https://api.github.com/repos/sanger/tol-lab-share/releases/latest" | jq -r '.tag_name')
VERSION=${LATEST_RELEASE_TAG#v}
echo "LATEST_RELEASE_TAG: $LATEST_RELEASE_TAG and VERSION: $VERSION"
- name: Create rst files for docs
run: |
pip install pydoctor
mkdir doc
pydoctor --make-html --html-output=doc tol_lab_share || true
pydoctor \
--project-name=tol-lab-share \
--project-version=$VERSION \
--project-url=https://github.com/sanger/tol-lab-share/ \
--html-viewsource-base=https://github.com/sanger/tol-lab-share/tree/$LATEST_RELEASE_TAG \
--make-html \
--html-output=doc \
--project-base-dir="." \
--docformat=restructuredtext \
--intersphinx=https://docs.python.org/3/objects.inv \
./tol_lab_share || true
- name: Upload artifact to GitHub Pages
uses: actions/upload-pages-artifact@v3
Expand Down
7 changes: 4 additions & 3 deletions tol_lab_share/messages/consumed/message_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ class MessageField:
"""A wrapper for extracting a field name and value from a record payload."""

def __init__(self, path: str, key: str, dict: dict[str, Any], transform: Callable | None = None):
"""Initialises the message field.
"""
Initialises the message field.
Args:
path (str): The path in the message to reach the field.
key (str): The key for the field.
dict (dict[str, Any]): The record payload as a dictionary.
transform (Callable | None, optional): A transform function for the extracted value.
record (dict[str, Any]): The record payload as a dictionary.
transform (Optional[Callable], optional): A transform function for the extracted value.
Use this to convert the value to a different type or perform mappings.
Defaults to None (no transformation).
"""
Expand Down

0 comments on commit b587eb9

Please sign in to comment.