Add Python API documentation generation with pdoc3
This commit adds automated Python API documentation generation for all workspace packages using pdoc3: - Add contrib/api/generate-python-docs.py script to generate docs - Add Makefile targets: python-docs and python-docs-clean - Add GitHub Actions workflow for nightly documentation generation - Documents 5 packages: pyln.client, pyln.proto, pyln.grpc, pyln.testing, pyln.spec.bolt7 - Creates beautiful index page with cards linking to each package - Stores generated docs as artifacts with 90-day retention - Add pdoc3 and markdown to dev dependencies Bug fix: - Fix pyln-client version.py: __all__ must contain strings, not class objects This was causing "TypeError: attribute name must be string, not 'type'" in pdoc3 Documentation is generated to docs/python/ which is excluded from version control. Run 'make python-docs' to generate locally, or download from nightly workflow artifacts. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
58
.github/workflows/python-docs-nightly.yaml
vendored
Normal file
58
.github/workflows/python-docs-nightly.yaml
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
name: Python API Docs (Nightly)
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# Run at 3 AM UTC every day
|
||||
- cron: '0 3 * * *'
|
||||
# Allow manual triggers for testing
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: python-docs-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
generate-docs:
|
||||
name: Generate Python API Documentation
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python 3.10
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.10"
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
uv sync --all-extras
|
||||
|
||||
- name: Generate documentation
|
||||
run: |
|
||||
make python-docs
|
||||
|
||||
- name: Upload documentation artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: python-api-docs
|
||||
path: docs/python
|
||||
retention-days: 90
|
||||
|
||||
- name: Add summary to job
|
||||
run: |
|
||||
echo "## Python API Documentation Generated" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "📚 Documentation has been generated for the following packages:" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- pyln.client - Client library and plugin library" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- pyln.proto - Lightning Network protocol implementation" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- pyln.grpc - gRPC protocol definitions" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- pyln.testing - Testing utilities" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- pyln.spec.bolt7 - BOLT #7 specification implementation" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "Download the artifact to view the complete API documentation." >> $GITHUB_STEP_SUMMARY
|
||||
Reference in New Issue
Block a user