Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ jobs:
- name: Build Package
if: success()
run: |
uv build
scripts/export_build_constraints.sh /tmp/build-constraints.txt
uv build -b /tmp/build-constraints.txt
- name: Export requirements.txt
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
run: |
. /opt/ros/humble/setup.sh && \
uv sync --all-extras --dev --all-packages && \
uv build --all-packages
scripts/export_build_constraints.sh /tmp/build-constraints.txt && \
uv build --all-packages -b /tmp/build-constraints.txt
- run: |
. /opt/ros/humble/setup.sh && uv run mkdocs gh-deploy --strict --force
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,19 @@ This method builds Python packages (wheel files) that can be installed using `uv
git clone --recursive https://github.com/tier4/sync_tooling.git
cd sync_tooling

uv build --all-packages
scripts/export_build_constraints.sh /tmp/build-constraints.txt
uv build --all-packages -b /tmp/build-constraints.txt
```

`export_build_constraints.sh` writes pinned protobuf codegen dependency versions from
`uv.lock` so isolated `uv build` does not re-resolve newer Hatch hook dependencies.

During development, `uv sync` also runs protobuf codegen for `sync-tooling-msgs` (Hatch hook).
Workspace `[tool.uv] build-constraint-dependencies` in `pyproject.toml` keeps that codegen aligned
with the locked runtime `protobuf` version. When bumping `protobuf` or related packages in
`uv.lock`, update `build-constraint-dependencies` to the same pins (or run
`scripts/export_build_constraints.sh` and copy the versions).

This will generate a `dist` directory with the built packages, and the `dist/*.whl` files can be
installed using `pip`:

Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ diag-worker = "diag_worker.main:main"

[tool.uv]
python-preference = "only-system"
# Pin codegen deps during `uv sync` workspace builds (see scripts/export_build_constraints.sh).
build-constraint-dependencies = [
"protobuf==6.33.4",
"mypy-protobuf==5.0.0",
"hatch-protobuf==0.5.0",
"types-protobuf==6.32.1.20251210",
]

[tool.uv.sources]
journal_monitor = { workspace = true }
Expand Down
3 changes: 2 additions & 1 deletion scripts/cloudflare_pages_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ dpkg --fsys-tarfile libgvc6*.deb | tar -xf - -C graphviz/
graphviz_dir="$(realpath graphviz)"
export PATH="$PATH:$graphviz_dir/usr/bin"
uv sync --all-packages --all-extras
uv build --all-packages
scripts/export_build_constraints.sh /tmp/build-constraints.txt
uv build --all-packages -b /tmp/build-constraints.txt
uv run mkdocs build --strict
41 changes: 41 additions & 0 deletions scripts/export_build_constraints.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env bash
# Copyright 2025 TIER IV, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -euo pipefail

if [[ $# -lt 1 ]]; then
echo "Usage: $0 <output-path>" >&2
exit 1
fi

out="$1"
pattern='^(protobuf|mypy-protobuf|hatch-protobuf|types-protobuf)=='

strip_constraints() {
grep -E "$pattern" | sed -E 's/\s*\\?\s*$//' | awk '{print $1}'
}

tmp="$(mktemp)"
trap 'rm -f "$tmp"' EXIT

uv export --frozen --package sync-tooling-msgs --only-group dev 2>/dev/null | strip_constraints >"$tmp"

if ! grep -q '^types-protobuf==' "$tmp"; then
uv export --frozen --package sync-tooling-msgs 2>/dev/null | strip_constraints >>"$tmp"
fi

sort -u "$tmp" >"$out"

# Keep [tool.uv] build-constraint-dependencies in pyproject.toml aligned with this output.
8 changes: 7 additions & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading