Skip to content

Commit a9728e4

Browse files
committed
chore: generate docs in markdown
Add the command `just pgai generate-docs` to update the docs. The `just install-commit-hook` will also install a hook that updates the docs automatically, if any `projects/pgai/pgai/*.python` file changes.
1 parent 477cba2 commit a9728e4

File tree

11 files changed

+3301
-28
lines changed

11 files changed

+3301
-28
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,15 @@ jobs:
156156
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
157157
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
158158

159+
- name: Check if docs are outdated
160+
run: |
161+
just pgai generate-docs
162+
if git diff --name-only HEAD -- projects/pgai/docs/.generated-files.txt | grep -q . ; then
163+
echo "::error:: Documentation is out of date. Please run 'just pgai generate-docs', or install the git hooks 'just install-git-hooks' and commit"
164+
exit 1
165+
fi
166+
echo "Documentation is up to date!"
167+
159168
build-and-test-pgai-db-module:
160169
needs: authorize
161170
runs-on: ubuntu-latest
@@ -222,4 +231,4 @@ jobs:
222231
source venv/bin/activate
223232
pip install --upgrade pip
224233
pip install -e .
225-
working-directory: ./projects/pgai
234+
working-directory: ./projects/pgai

.pre-commit-config.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
default_install_hook_types:
2+
- pre-commit
3+
- commit-msg
4+
5+
repos:
6+
- repo: local
7+
hooks:
8+
- id: update-docs
9+
name: Update pydoc-markdown documentation
10+
entry: bash -c 'uv tool run pydoc-markdown && git add docs/api.md'
11+
language: system
12+
files: ^projects/pgai/pgai/.*\.py$
13+
pass_filenames: false
14+
stages: [pre-commit]
15+
16+
- repo: https://github.com/compilerla/conventional-pre-commit
17+
rev: v4.2.0
18+
hooks:
19+
- id: conventional-pre-commit
20+
stages: [commit-msg]
21+
args: [--verbose]

justfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,5 @@ ci:
1919

2020
# Install semantic commit message hook
2121
@install-commit-hook:
22-
curl --fail -s -o .git/hooks/commit-msg https://raw.githubusercontent.com/hazcod/semantic-commit-hook/master/commit-msg
23-
chmod u+x .git/hooks/commit-msg
24-
echo "commit-msg hook installed"
22+
uv tool install pre-commit
23+
uv tool run pre-commit install

projects/pgai/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
33
PYTHONUNBUFFERED=1 \
44
UV_PROJECT_ENVIRONMENT=/usr/local/
55
WORKDIR /build
6-
COPY --from=ghcr.io/astral-sh/uv:0.5.20 /uv /uvx /bin/
6+
COPY --from=ghcr.io/astral-sh/uv:0.7.10 /uv /uvx /bin/
77

88
COPY pyproject.toml uv.lock ./
99

@@ -25,4 +25,4 @@ COPY pgai /app/pgai
2525
USER pgaiuser
2626

2727
ENTRYPOINT ["python", "-m", "pgai", "vectorizer", "worker"]
28-
CMD ["-c", "4"]
28+
CMD ["-c", "4"]
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
md5 70ef3c2ad36ca5b33c7d95e13bbf3076 api/semantic-catalog.md
2+
md5 0c00cb79ede0d48d765b7ce43a2d0d74 mkdocs.yml

0 commit comments

Comments
 (0)