Sync Code Generation
The async modules are the hand-written source of truth for mirrored SDK APIs. Their sync twins are committed generated artifacts.
When changing a mirrored client, endpoint, middleware, protocol, or service:
- Edit the
async_*source. - Run
just gen-sync. - Review the generated sync diff.
- Run
just check-gen-syncand the normal verification suite.
Do not edit files with the generated header directly. If generated sync code is
wrong, fix scripts/gen_sync.py or the async source, then regenerate.
Commands
Section titled “Commands”just gen-syncjust check-gen-syncuv run python scripts/gen_sync.py --only src/ksef2/clients/async_invoices.py --diffcheck-gen-sync fails when any generated sync file differs from a fresh
generation. The same guard also runs in just release-check and in
tests/unit/test_generated_sync.py, so stale generated files are caught by the
plain unit suite.
Exclusions
Section titled “Exclusions”Some files intentionally stay hand-written because their sync and async
lifecycles are not mechanical twins, including root clients, HTTP transports,
__init__.py files, and already-shared helper modules. The authoritative list
and justification for each exclusion lives in scripts/gen_sync.py.