Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d69b7f6
docs: generate API docs
a-delannoy Jul 23, 2025
36610dd
docs: fix docusaurus interpretation of mdx files with Icon in it
a-delannoy Jul 23, 2025
89511ae
docs: configure docusaurus sidebar
a-delannoy Jul 23, 2025
469bf19
chore: add invoke task to generate the documentation
a-delannoy Jul 23, 2025
9b881e8
build: add mdxify package
a-delannoy Jul 23, 2025
c016809
ci: add a rule for checking the SDK API obsolescence
a-delannoy Jul 23, 2025
1484494
style: fix some python lint error
a-delannoy Jul 23, 2025
1acb7b0
style: fix some mispelling and style issue in docstrings
a-delannoy Jul 23, 2025
ff31be5
docs: update API documentation
a-delannoy Jul 23, 2025
9d0a674
style: fix linting issues in the generated documentation
a-delannoy Jul 23, 2025
ce543b8
ci: update the CI rule to fix linting on the generated documentation
a-delannoy Jul 23, 2025
0619e37
build: move mdxify to dev group in poetry
a-delannoy Jul 23, 2025
f733340
ci: update the CI rule to install markdownlint for properly fixing ge…
a-delannoy Jul 24, 2025
d017fcf
ci: troubleshoot CI rule
a-delannoy Jul 24, 2025
0703af8
docs: update docs after rebase
a-delannoy Jul 24, 2025
9f99440
ci: resume git diff check
a-delannoy Jul 24, 2025
ed095d2
ci: exclude the newly generated documentation from vale inspection
a-delannoy Jul 25, 2025
fb08b5f
docs: update API docs after rebasing
a-delannoy Jul 25, 2025
4980873
ci: fine tune find command
a-delannoy Jul 25, 2025
e101d9a
chore: add towncrier changelog fragment for #201
a-delannoy Jul 25, 2025
9f13b94
docs: relocate the API reference on the sidebar
a-delannoy Jul 28, 2025
59a7645
refactor: update invoke task for generate API docs
a-delannoy Aug 1, 2025
cf30309
docs: update the documentation to only a specified subset
a-delannoy Aug 1, 2025
2321af2
Merge branch 'stable' into ady-add-api-doc-generation
a-delannoy Aug 1, 2025
a0a8686
docs: update documentation
a-delannoy Aug 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 47 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
token: ${{ github.token }}
filters: .github/file-filters.yml

# ------------------------------------------ All Linter ------------------------------------------
# ------------------------------------------ All Linter ------------------------------------------

yaml-lint:
if: needs.files-changed.outputs.yaml == 'true'
Expand Down Expand Up @@ -84,7 +84,6 @@ jobs:
- name: "Linting: ruff format"
run: "ruff format --check --diff ."


markdown-lint:
if: |
needs.files-changed.outputs.documentation == 'true' ||
Expand Down Expand Up @@ -119,7 +118,6 @@ jobs:
env:
SHELLCHECK_OPTS: --exclude=SC2086 --exclude=SC2046 --exclude=SC2004 --exclude=SC2129


documentation:
defaults:
run:
Expand All @@ -141,7 +139,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache: "npm"
cache-dependency-path: docs/package-lock.json
- name: "Install dependencies"
run: npm install
Expand Down Expand Up @@ -180,6 +178,50 @@ jobs:
- name: "Validate generated documentation"
run: "poetry run invoke docs-validate"

check-api-documentation-obsolescence:
if: |
always() && !cancelled() &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled') &&
(needs.files-changed.outputs.python == 'true') || (needs.files-changed.outputs.documentation_generated == 'true')
needs: ["prepare-environment", "files-changed", "yaml-lint", "python-lint"]
runs-on: "ubuntu-22.04"
env:
DOCS_COMMAND: "poetry run invoke generate-sdk-api-docs"
SDK_API_DOCS_DIR: "docs/docs/python-sdk/sdk_ref"
timeout-minutes: 5
steps:
- name: "Check out repository code"
uses: "actions/checkout@v4"
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: "Setup Python environment"
run: |
pipx install poetry==${{ needs.prepare-environment.outputs.POETRY_VERSION }}
poetry config virtualenvs.create true --local
poetry env use 3.12
- name: "Install dependencies"
run: "poetry install --no-interaction --no-ansi --extras ctl"
- name: "Setup environment"
run: "pip install invoke toml"
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- name: Install markdown linter
run: npm install -g markdownlint-cli2
- name: "Generate SDK API documentation"
run: ${{ env.DOCS_COMMAND }}
- name: "Check if SDK API documentation needs to be refreshed"
run: |
git diff --quiet ${SDK_API_DOCS_DIR}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add this as an invoke command too so that it's consistent with how we do it in other repos.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate a bit about which part here you'd add as an invoke command ?
For now, I added an invoke command to generate the API docs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean that we can run poetry run invoke generate-sdk-api-docs to generate the docs but then have another command to validate. It could simplify to also have a shortcut for the git diff like we have here:
https://github.com/opsmill/infrahub/blob/infrahub-v1.3.4/tasks/backend.py#L176

This part isn't critical though just a suggestion.


validate-documentation-style:
if: |
always() && !cancelled() &&
Expand All @@ -203,7 +245,7 @@ jobs:
env:
VALE_VERSION: ${{ env.VALE_VERSION }}
- name: "Validate documentation style"
run: ./vale $(find ./docs -type f \( -name "*.mdx" -o -name "*.md" \) )
run: ./vale $(find ./docs -type d -name sdk_ref -prune -false -o -type f \( -name "*.mdx" -o -name "*.md" \) )

unit-tests:
env:
Expand Down
1 change: 1 addition & 0 deletions changelog/201.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add support for automatic Python SDK API from docstrings in the code.
Loading
Loading