Skip to content

Commit 68cc8cf

Browse files
lanluo-nvidianarendasanTorch-TensorRT Github Bot
authored
Add uv update workflow (#3986)
Signed-off-by: Torch-TensorRT Github Bot <torch-tensorrt.github.bot@nvidia.com> Co-authored-by: Naren Dasan <naren@narendasan.com> Co-authored-by: Torch-TensorRT Github Bot <torch-tensorrt.github.bot@nvidia.com>
1 parent dcc0c6c commit 68cc8cf

File tree

3 files changed

+1014
-687
lines changed

3 files changed

+1014
-687
lines changed

.github/workflows/uv-update.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Sync uv.lock
2+
3+
on:
4+
schedule:
5+
# Every Monday at 03:00 UTC; adjust as needed
6+
- cron: "0 3 * * 1"
7+
push:
8+
# to remvoe: test only
9+
tags: [uv-update-v1]
10+
branches: [main]
11+
paths:
12+
- 'pyproject.toml'
13+
- 'setup.py'
14+
workflow_dispatch:
15+
16+
permissions:
17+
contents: write
18+
19+
jobs:
20+
sync-uv-lock:
21+
runs-on: linux.g5.4xlarge.nvidia.gpu
22+
if: ${{ ! contains(github.actor, 'pytorchbot') }}
23+
environment: pytorchbot-env
24+
container:
25+
image: pytorch/manylinux2_28-builder:cuda13.0
26+
options: --gpus all
27+
env:
28+
CUDA_VERSION: 13.0
29+
CUDA_HOME: /usr/local/cuda
30+
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
with:
35+
token: ${{ secrets.GH_PYTORCHBOT_TOKEN }}
36+
fetch-depth: 0
37+
38+
- name: Install uv
39+
uses: astral-sh/setup-uv@v7
40+
with:
41+
version: "latest"
42+
43+
- name: Install bazel
44+
run: |
45+
set -euo pipefail
46+
set -x
47+
curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.26.0/bazelisk-linux-amd64 \
48+
-o bazelisk-linux-amd64 \
49+
&& mv bazelisk-linux-amd64 /usr/local/bin/bazel \
50+
&& chmod +x /usr/local/bin/bazel
51+
bazel --version
52+
53+
- name: UV lock and check for changes
54+
id: check-changes
55+
working-directory: ${{ github.workspace }}
56+
run: |
57+
set -euo pipefail
58+
set -x
59+
git config --global safe.directory "$GITHUB_WORKSPACE"
60+
61+
if ! uv lock --refresh --prerelease=allow --verbose; then
62+
echo "Error: Failed to update uv.lock"
63+
exit 1
64+
fi
65+
echo "successfully ran uv lock"
66+
if git diff --quiet uv.lock; then
67+
echo "No changes to uv.lock"
68+
exit 0
69+
fi
70+
echo "has_changes=true" >> "$GITHUB_OUTPUT"
71+
echo "there is changes to the uv.lock file"
72+
73+
- name: Validate the changes
74+
id: validate-changes
75+
if: steps.check-changes.outputs.has_changes == 'true'
76+
run: |
77+
set -euo pipefail
78+
set -x
79+
if ! uv sync --frozen; then
80+
echo "Error: Failed to run uv sync --frozen"
81+
exit 1
82+
fi
83+
echo "valid_changes=true" >> "$GITHUB_OUTPUT"
84+
echo "successfully validated the changes to uv.lock"
85+
86+
- name: Auto-commit changes
87+
uses: stefanzweifel/git-auto-commit-action@v7
88+
if: steps.validate-changes.outputs.valid_changes == 'true'
89+
with:
90+
commit_message: "chore: update uv.lock"
91+
branch: main
92+
commit_options: "--no-verify --signoff"
93+
file_pattern: uv.lock
94+
commit_user_name: Torch-TensorRT Github Bot
95+
commit_user_email: torch-tensorrt.github.bot@nvidia.com
96+
commit_author: Torch-TensorRT Github Bot <torch-tensorrt.github.bot@nvidia.com>
97+
98+
concurrency:
99+
group: ${{ github.workflow }}-uv-update-${{ github.event.pull_request.number || github.ref_name }}-${{ github.event_name == 'workflow_dispatch' }}
100+
cancel-in-progress: true

pyproject.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ classifiers = [
3232
"Topic :: Software Development :: Libraries",
3333
]
3434
readme = { file = "README.md", content-type = "text/markdown" }
35-
requires-python = ">=3.10"
35+
requires-python = ">=3.10, <=3.13"
3636
keywords = [
3737
"pytorch",
3838
"torch",
@@ -93,7 +93,11 @@ include-package-data = false
9393

9494
[tool.uv]
9595
package = true
96-
environments = ["sys_platform == 'linux'", "sys_platform == 'windows'"]
96+
environments = ["sys_platform == 'linux'", "sys_platform == 'win32'"]
97+
required-environments = [
98+
"sys_platform == 'linux' and python_version >= '3.10' and python_version <= '3.13' and platform_machine == 'x86_64'",
99+
"sys_platform == 'win32' and python_version >= '3.10' and python_version <= '3.13' and platform_machine == 'AMD64'"
100+
]
97101
prerelease = "if-necessary-or-explicit"
98102
index-strategy = "unsafe-best-match"
99103

0 commit comments

Comments
 (0)