Skip to content

[v3-2-test] Speed up 'Generate the FastAPI API spec' prek hook (~2min → ~25s) (#64131)#66308

Merged
potiuk merged 1 commit intoapache:v3-2-testfrom
potiuk:backport-64131-openapi-sqlite-v3-2-test
May 3, 2026
Merged

[v3-2-test] Speed up 'Generate the FastAPI API spec' prek hook (~2min → ~25s) (#64131)#66308
potiuk merged 1 commit intoapache:v3-2-testfrom
potiuk:backport-64131-openapi-sqlite-v3-2-test

Conversation

@potiuk
Copy link
Copy Markdown
Member

@potiuk potiuk commented May 3, 2026

Summary

  • Cherry-picks Speed up 'Generate the FastAPI API spec' prek hook (~2min → ~25s) #64131 (main commit 5d9819fea5) to v3-2-test.
  • Switches the generate-openapi-spec prek hook from backend="postgres"
    to backend="sqlite" in scripts/ci/prek/generate_openapi_spec.py.
  • The OpenAPI spec generator only introspects FastAPI routes and does
    not query the database, so the postgres-container startup + migration
    overhead (~90s) is wasted.

#64131 was merged on main on 2026-03-24 and backported to v3-1-test
the same day as #64132 — but the cut of v3-2-test happened a few
hours earlier, so it landed without the fix. Same shape as the recent
#66209 backport (which fixed the providers OpenAPI spec generator
and the providers import-checker hooks); this is the matching core
hook, the last remaining backend="postgres" under
scripts/ci/prek/.

Test plan

  • CI Static checks job is faster on v3-2-test
  • Generate the FastAPI API spec prek hook still produces a clean
    spec (no functional change beyond DB backend)

Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 4.7)

Generated-by: Claude Code (Opus 4.7) following the guidelines

…ache#64131)

The OpenAPI spec generation doesn't query the database — it only
introspects FastAPI routes. Using postgres backend was adding ~90s of
postgres container startup and migration overhead for no reason.
Switching to sqlite cuts the hook from ~2 minutes to ~25 seconds.

(cherry picked from commit 5d9819f)
@potiuk potiuk merged commit 28b8750 into apache:v3-2-test May 3, 2026
2 checks passed
@potiuk potiuk deleted the backport-64131-openapi-sqlite-v3-2-test branch May 3, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants