Local pipeline for developers: OpenAPI -> Python SDK -> Site Agent
This document describes the process of regenerating and linking the
Waldur Python SDK (waldur-api-client) for local development. The SDK
is published to GitHub and consumed as a git dependency, but a local
pipeline is essential when you need to work with unreleased Mastermind
API changes before they are officially deployed.
Background
The production pipeline runs in GitLab CI on the waldur-mastermind
repository:
uv run waldur spectacularexports the OpenAPI schema.- A custom fork of
openapi-python-clientgenerates the Python SDK. - The generated
waldur_api_client/package is pushed togithub.com/waldur/py-client(main branch). waldur-site-agentconsumes it viapyproject.toml:
1 2 | |
Prerequisites
Before proceeding, ensure you have the following:
- uv: For managing Python dependencies.
- pip: For installing the OpenAPI code generator.
- Waldur MasterMind: Cloned and set up in a directory (default:
../waldur-mastermind). - py-client: Cloned from
github.com/waldur/py-client(default:../py-client).
Steps to regenerate and link the SDK
1. Generate the OpenAPI schema
In the waldur-mastermind directory, run:
1 | |
This produces waldur-openapi-schema.yaml with the full API definition.
2. Generate the Python SDK from the schema
Still in the waldur-mastermind directory:
1 2 3 4 5 6 | |
This creates (or overwrites) the py-client/ directory with the
generated waldur_api_client package.
3. Copy the generated code to the local py-client checkout
1 | |
4. Point waldur-site-agent at the local py-client
Temporarily override the source in pyproject.toml:
1 2 | |
Then re-sync dependencies:
1 | |
5. Verify
1 | |
This should print the path to your local py-client checkout.
Helper script
A convenience script is provided at docs/update-local-sdk.sh:
1 | |
It automates steps 1-4 above. After running it, remember to revert the
pyproject.toml source change before committing.
Reverting to the published SDK
To switch back to the GitHub-hosted SDK:
1 2 | |
Then:
1 | |