Local pipeline for developers: OpenAPI -> Python SDK -> Site Agent
This document describes how to regenerate the Waldur Python SDK (waldur-api-client) from a
local Mastermind checkout and point the site agent at it. You need this when you work against
Mastermind API changes that have not been published yet.
How the agent consumes the SDK
The SDK is generated in the waldur-mastermind GitLab CI pipeline:
uv run waldur spectacularexports the OpenAPI schema.- A custom fork of
openapi-python-clientgenerates thewaldur_api_clientpackage. - The package is pushed to
github.com/waldur/py-clientand published to PyPI aswaldur-api-client, including pre-release builds.
waldur-site-agent depends on an exact published version, pinned in pyproject.toml:
1 2 3 4 5 | |
To pick up a newer published SDK, change that pin and run uv lock. There is no
[tool.uv.sources] entry for the SDK in the committed pyproject.toml; the local link below adds
one temporarily.
Prerequisites
- uv and pip
- Waldur Mastermind cloned and set up (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:
1 | |
2. Generate the Python SDK from the schema
Still in the waldur-mastermind directory:
1 2 3 4 5 6 | |
3. Copy the generated code to the local py-client checkout
1 | |
4. Point waldur-site-agent at the local py-client
Add a source override to the site agent's pyproject.toml:
1 2 | |
and re-sync:
1 | |
The path source replaces the pinned PyPI version even when the local package carries a different version number.
5. Verify
1 | |
This must print a path inside your local py-client checkout.
Helper script
docs/update-local-sdk.sh runs steps 1–5 and fails if waldur_api_client does not load from the
local checkout afterwards:
1 2 3 4 5 6 7 | |
Before it changes anything, the script checks that the py-client path holds a pyproject.toml for
waldur-api-client and a waldur_api_client/ directory, because step 4 replaces that directory.
It edits [tool.uv.sources] with a TOML parser, so running it again replaces the previous link
rather than adding a second one.
Reverting to the published SDK
Remove the override before committing — linking edits both pyproject.toml and uv.lock:
1 | |
It removes the source entry, re-locks and re-syncs, which brings uv.lock back to the pinned version.
If you edited nothing else, git checkout pyproject.toml uv.lock && uv sync --all-packages does the
same.