Skip to content

Unify protobuf codegen with uv.lock at uv sync#38

Closed
Owen-Liuyuxuan wants to merge 4 commits into
mainfrom
fix/uv-build-constraints
Closed

Unify protobuf codegen with uv.lock at uv sync#38
Owen-Liuyuxuan wants to merge 4 commits into
mainfrom
fix/uv-build-constraints

Conversation

@Owen-Liuyuxuan
Copy link
Copy Markdown
Contributor

@Owen-Liuyuxuan Owen-Liuyuxuan commented Jun 2, 2026

Summary

  • CI pytest failed before uv build: uv sync editable-installs sync-tooling-msgs and runs Hatch protobuf codegen in a PEP 517 isolated environment, which could resolve newer protobuf than the locked runtime in .venv.
  • Add workspace [tool.uv] build-constraint-dependencies so every uv sync build uses the same pins as uv.lock (protobuf, hatch-protobuf, mypy-protobuf, types-protobuf).
  • Keep scripts/export_build_constraints.sh + uv build -b for release wheels (build-constraint-dependencies does not apply to standalone uv build per uv#18283).
  • Closes the mis-scoped approach in Use --no-build-isolation for uv build after sync #39 (no-build-isolation on uv build only).

Test plan

  • uv sync --all-extras --dev --all-packages then import sync_tooling_msgs.clock_id_pb2
  • uv run pytest sync_tooling_msgs/tests
  • CI build.yaml green (pytest + build)

Owen-Liuyuxuan and others added 3 commits June 2, 2026 22:35
Co-authored-by: Cursor <cursoragent@cursor.com>
uv sync builds sync-tooling-msgs in an isolated environment before pytest,
which could generate *_pb2.py with a newer protoc than the locked runtime
(6.33.5 gencode vs 6.33.4 runtime). Apply build-constraint-dependencies
so editable installs use the same pins as uv build -b.

Co-authored-by: Cursor <cursoragent@cursor.com>
uv lock revision 3 captures workspace build constraints so uv sync
installs sync-tooling-msgs with the same protobuf pins as uv build -b.

Co-authored-by: Cursor <cursoragent@cursor.com>
Document why build-constraint-dependencies must stay aligned with uv.lock
when bumping protobuf, and note the same pins in export_build_constraints.sh.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Owen-Liuyuxuan Owen-Liuyuxuan changed the title Pin uv build codegen deps to uv.lock (build constraints) Unify protobuf codegen with uv.lock at uv sync Jun 2, 2026
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 2, 2026

@Owen-Liuyuxuan Owen-Liuyuxuan requested a review from mojomex June 2, 2026 14:05
@mojomex
Copy link
Copy Markdown
Collaborator

mojomex commented Jun 3, 2026

Hey @Owen-Liuyuxuan, thank you for the investigation and fix work, much appreciated!
As for

Please let me know what you think!

@Owen-Liuyuxuan
Copy link
Copy Markdown
Contributor Author

@mojomex Because in the pytest you design,

image

The problem of protobuf error happens before uv build. We need to solve the problem right at uv sync. So uv build --no-build-isolation does not solve your pytest. That is the core problem

@Owen-Liuyuxuan
Copy link
Copy Markdown
Contributor Author

@mojomex Close this for you PR

@Owen-Liuyuxuan Owen-Liuyuxuan deleted the fix/uv-build-constraints branch June 3, 2026 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants