Skip to content

[BUG](ci) Generate PySpark expressions before building the published wheel - #626

Open
Seth Fitzsimmons (sethfitz) wants to merge 1 commit into
mainfrom
fix-pyspark-wheel-packaging
Open

[BUG](ci) Generate PySpark expressions before building the published wheel#626
Seth Fitzsimmons (sethfitz) wants to merge 1 commit into
mainfrom
fix-pyspark-wheel-packaging

Conversation

@sethfitz

Copy link
Copy Markdown
Collaborator

Fixes #625.

Problem

overture-schema-pyspark ships 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 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. _registry.py walks that namespace at import, so an installed consumer gets an empty REGISTRY and validate_model() discovers no models. The build produced the empty wheel with no error.

Change

  • Generate the expression tree (make generate-pyspark) in the publish workflow before uv build, gated to the overture-schema-pyspark matrix entry.
  • Add a post-build guard: if the pyspark wheel contains no expressions/generated/*.py, abort the publish — a silent empty wheel becomes a loud failure.

Verification

Built the wheel and sdist locally under uv_build:

Path generated in wheel in sdist guard
no generate step (current CI) 0 0 fires (aborts)
generate step (this PR) all model modules all passes

The guard checks the wheel; uv build builds the wheel from the sdist, so a populated wheel confirms a populated sdist.

…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>
@github-actions

Copy link
Copy Markdown

🗺️ Schema reference docs preview is live!

🌍 Preview https://staging.overturemaps.org/schema/pr/626/schema/index.html
🕐 Updated Jul 31, 2026 19:40 UTC
📝 Commit 0576be4
🔧 env SCHEMA_PREVIEW true

Note

♻️ This preview updates automatically with each push to this PR.

@lowlydba

John McCall (lowlydba) commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

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 src/overture at build time, so wheel contents depend on what ran before uv build. A hatchling build hook makes the wheel correct by construction:

[tool.hatch.build.targets.wheel.hooks.custom]
path = "hatch_build.py"

with a hook that runs codegen if expressions/generated/ is absent and fails the build if it comes up empty. Then any build path (this workflow, a local uv build, a consumer building from sdist) produces a complete wheel, and the guard lives inside the build where a new publish path can't skip it. The unzip -l check in YAML works, but it only protects this one workflow.

❗ Caveat: codegen imports the Pydantic models, so the hook needs overture-schema-system importable at build time. Either add it to build-system.requires or generate in the sdist hook only (CI has the workspace synced) and let wheels build from the populated sdist (feels trivial either way?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG](pyspark) Published overture-schema-pyspark wheel ships without its generated validation expressions

2 participants