[BUG](ci) Generate PySpark expressions before building the published wheel - #626
[BUG](ci) Generate PySpark expressions before building the published wheel#626Seth Fitzsimmons (sethfitz) wants to merge 1 commit into
Conversation
…heel overture-schema-pyspark's generated validation expressions are no longer committed to git; they are regenerated on demand from the Pydantic models. The publish workflow synced the workspace and ran `uv build` with no codegen step, so `expressions/generated/` was absent on disk at build time and the wheel (and sdist) shipped without it -- validate_model() would discover no models to run. uv_build silently produced the empty wheel. Generate the tree before building (only for overture-schema-pyspark), and add a post-build guard that aborts publish if the wheel carries no generated expressions, so a future regression fails loudly instead of shipping a hollow package. Verified end to end under the uv_build backend: without the generate step the wheel and sdist contain zero generated modules and the guard fires; with it, all generated model modules ship in both and the guard passes. Signed-off-by: Seth Fitzsimmons <seth@mojodna.net>
🗺️ Schema reference docs preview is live!
Note ♻️ This preview updates automatically with each push to this PR. |
|
suggestion (non-blocking): Seth Fitzsimmons (@sethfitz) what about moving the codegen into the build itself instead of the workflow? This shifts us from making per-package exceptions in the monorepo to letting each package own its configuration needs. The root cause is that hatchling packages whatever is under [tool.hatch.build.targets.wheel.hooks.custom]
path = "hatch_build.py"with a hook that runs codegen if ❗ Caveat: codegen imports the Pydantic models, so the hook needs |
Fixes #625.
Problem
overture-schema-pysparkships generated validation expressions that are not present in git; they are regenerated on demand from the Pydantic models. The publish workflow synced the workspace and ranuv buildwith no codegen step, soexpressions/generated/was absent on disk at build time and the wheel and sdist shipped without it._registry.pywalks that namespace at import, so an installed consumer gets an emptyREGISTRYandvalidate_model()discovers no models. The build produced the empty wheel with no error.Change
make generate-pyspark) in the publish workflow beforeuv build, gated to theoverture-schema-pysparkmatrix entry.expressions/generated/*.py, abort the publish — a silent empty wheel becomes a loud failure.Verification
Built the wheel and sdist locally under uv_build:
The guard checks the wheel;
uv buildbuilds the wheel from the sdist, so a populated wheel confirms a populated sdist.