ci: PR semver gate (griffe) — enforce version bump on breaking API changes#205
Merged
Conversation
martinkersner
marked this pull request as ready for review
July 15, 2026 12:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a PR-only "semver check" CI gate — the Python analog of the Rust sibling repo's
cargo-semver-checksjob. On every pull request it diffs the public API of thedatamaxipackage between the PR base commit and the PR head, and fails when the version bump indatamaxi/__version__.pyis smaller than the change requires.Why: several public modules (
_endpoints.py,_ws_endpoints.py,_ws_models.py) are codegen-generated and churn often. Rather than block that churn, we enforce that the version bump matches the churn.How it maps to the Rust
cargo-semver-checksgategriffe check(the standard Python public-API diff tool; static/AST-based).github/scripts/check_semver.py0.x-aware policy (future-proof)
0): breaking change ⇒ at least a minor bump (0.29.0 → 0.30.0)griffe checkdoesn't surface)Exact griffe command
-a= old ref (PR base), default-b= working tree (PR head). Exit1= breaking changes; the script also verifies the base ref up front and detects griffe tracebacks so a git error is never mistaken for a breakage. griffe checks out the base ref via an internal git worktree → workflow usesfetch-depth: 0.Files
.github/workflows/semver.yml—on: pull_request,permissions: contents: read,checkout@v4+fetch-depth: 0,setup-uv@v6,uv pip install --system 'griffe>=2,<3', runs the script with${{ github.event.pull_request.base.sha }}..github/scripts/check_semver.py— stdlib + griffe only; black/flake8-clean under the repo config.Tested locally (griffe 2.1.0, offline, no API key)
v0.28.0(0.26.3) → wt 0.29.0HEAD→ wt (identical)0.27.0deadbeef123fetch-depth: 0Confirmed griffe analyzes the flat-layout
datamaxipackage (includingaio/andws/) with neitherhttpxnorwebsocketsinstalled — no optional deps needed, no stderr warnings.Caveats / limitations
Attribute value was changed) and param moves/removals as breaking — this is intentional: such PRs must carry a minor bump. Expect the gate to require a version bump on most_endpoints.py/WS-sync PRs.griffe check; the gate only enforces on breaking changes + never-decreasing version (it won't force a patch bump for pure additions).