4.0 KiB
Python Client Documentation
This document describes how the Python client documentation is generated and deployed, similar to the TypeScript client.
Overview
The Python client uses pdoc to automatically generate API documentation from docstrings in the code, similar to how the TypeScript client uses TypeDoc.
Architecture
Following the same pattern as the TypeScript client:
- Documentation Generator: pdoc (Python) vs TypeDoc (TypeScript)
- Build Script:
build_pdoc.sh(similar tobuild_typedoc.shfor TS) - Output Directory:
docs/containing static HTML - Deployment: Copied to
/frontend/static/pydocs/during Docker build - URL: Accessible at
https://app.windmill.dev/pydocs/wmill.html
Building Documentation
How It Works
The Python client documentation follows the same pattern as the TypeScript client:
- Docs are checked into git - The
docs/directory is committed to the repository - Built during releases - When
./build.shruns (on releases or manually), it calls./build_pdoc.sh - Copied during Docker build - The Dockerfile copies pre-built docs to the frontend
Locally
To build/update the documentation:
cd /path/to/windmill/python-client
./build_pdoc.sh
This will:
- Create a virtual environment if needed (
.venv/- gitignored) - Install pdoc and dependencies
- Generate HTML documentation in
./docs/ - Documentation will be available at
file://$(pwd)/docs/wmill.html
After building, you should commit the updated docs:
git add docs/
git commit -m "Update Python client documentation"
In CI/CD
The documentation is built automatically during the release process:
- On release (
pypi_on_release.ymlworkflow triggers on version tags) - Runs
./publish.sh→ calls./build.sh→ calls./build_pdoc.sh - Docs are generated and should be committed separately or before the release
In Docker Build
The documentation is copied during Docker build (see Dockerfile line 51):
COPY /python-client/docs/ /frontend/static/pydocs/
This makes the docs available at https://app.windmill.dev/pydocs/ in production.
Documentation Structure
The generated documentation includes:
- Main Module (
wmill.html): Overview and module-level functions - Client Class (
wmill/client.html): Full Windmill class API reference - S3 Types (
wmill/s3_types.html): S3 integration types and helpers - S3 Reader (
wmill/s3_reader.html): S3 file reading utilities
All documentation is automatically generated from:
- Function/class docstrings
- Type hints
- Parameter descriptions
- Return type annotations
Writing Good Documentation
To maintain quality documentation:
-
Use clear docstrings following Google or NumPy style:
def my_function(param1: str, param2: int = 0) -> dict: """Short description of function. Longer description with more details about what the function does and any important notes. Args: param1: Description of param1 param2: Description of param2 (default: 0) Returns: Description of return value Example: >>> result = my_function("test", 5) >>> print(result) {'status': 'ok'} """ -
Add type hints - pdoc uses them to generate better documentation
-
Include examples in docstrings where helpful
-
Keep descriptions concise but complete
Comparison with TypeScript Client
| Aspect | TypeScript | Python |
|---|---|---|
| Generator | TypeDoc | pdoc |
| Build Script | build_typedoc.sh |
build_pdoc.sh |
| Output Dir | docs/ |
docs/ |
| Hosted At | /tsdocs/ |
/pydocs/ |
| Entry Point | modules.html |
wmill.html |
References
- Windmill Docs: https://windmilldocs/docs/advanced/2_clients/python_client.md
- TypeScript Client Docs: https://app.windmill.dev/tsdocs/modules.html
- Python Client Docs: https://app.windmill.dev/pydocs/wmill.html
- pdoc Documentation: https://pdoc.dev/