From 351638c184b47f580efde16cabfca9e8dddbc3a5 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Mon, 31 Mar 2025 10:28:46 -0400 Subject: [PATCH 1/8] Check that intended python version is being used --- .github/workflows/ci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b079e60b..d885617ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,6 +49,14 @@ jobs: - uses: astral-sh/setup-uv@v5 - run: uv tool install poethepoet - run: uv sync --all-extras + - name: Check python version + shell: bash + run: | + actual=$(python -c "import sys; print('.'.join(map(str, sys.version_info[:2])))") + if [[ "$actual" != "${{ matrix.python }}" ]]; then + echo "Python version in use ($actual) does not match intended version (${{ matrix.python }})" + exit 1 + fi - run: poe bridge-lint if: ${{ matrix.clippyLinter }} - run: poe lint From 695efc4f805951b4324e0979fc12c0bdda9bee48 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Mon, 31 Mar 2025 10:33:57 -0400 Subject: [PATCH 2/8] Don't use setup-python action --- .github/workflows/build-binaries.yml | 5 +---- .github/workflows/ci.yml | 5 +---- .github/workflows/run-bench.yml | 5 +---- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-binaries.yml b/.github/workflows/build-binaries.yml index 7186238d6..4d8d83145 100644 --- a/.github/workflows/build-binaries.yml +++ b/.github/workflows/build-binaries.yml @@ -30,9 +30,6 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive - - uses: actions/setup-python@v5 - with: - python-version: "3.13" # Install Rust locally for non-Linux (Linux uses an internal docker # command to build with cibuildwheel which uses rustup install defined @@ -44,7 +41,7 @@ jobs: with: workspaces: temporalio/bridge -> target - uses: astral-sh/setup-uv@v5 - - run: uv sync --all-extras + - run: uv sync --all-extras --python 3.13 # Add the source dist only for Linux x64 for now - if: ${{ matrix.package-suffix == 'linux-amd64' }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d885617ef..0c8892d53 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,9 +38,6 @@ jobs: - uses: Swatinem/rust-cache@v2 with: workspaces: temporalio/bridge -> target - - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python }} - uses: arduino/setup-protoc@v3 with: # TODO(cretz): Can upgrade proto when https://github.com/arduino/setup-protoc/issues/99 fixed @@ -48,7 +45,7 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} - uses: astral-sh/setup-uv@v5 - run: uv tool install poethepoet - - run: uv sync --all-extras + - run: uv sync --all-extras --python ${{ matrix.python }} - name: Check python version shell: bash run: | diff --git a/.github/workflows/run-bench.yml b/.github/workflows/run-bench.yml index 6dcad63e8..ace6034bf 100644 --- a/.github/workflows/run-bench.yml +++ b/.github/workflows/run-bench.yml @@ -35,9 +35,6 @@ jobs: - uses: Swatinem/rust-cache@v2 with: workspaces: temporalio/bridge -> target - - uses: actions/setup-python@v5 - with: - python-version: "3.13" - uses: arduino/setup-protoc@v3 with: # TODO(cretz): Can upgrade proto when https://github.com/arduino/setup-protoc/issues/99 fixed @@ -47,7 +44,7 @@ jobs: - uses: astral-sh/setup-uv@v5 # Build - run: uv tool install poethepoet - - run: uv sync --all-extras + - run: uv sync --all-extras --python 3.13 - run: poe build-develop-with-release # Run a bunch of bench tests. We run multiple times since results vary. From 5aa1f2f39d6e12297196516af5c896854acc5c4d Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Mon, 31 Mar 2025 10:36:40 -0400 Subject: [PATCH 3/8] Deliberate error --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c8892d53..7dca234b5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,7 @@ jobs: shell: bash run: | actual=$(python -c "import sys; print('.'.join(map(str, sys.version_info[:2])))") - if [[ "$actual" != "${{ matrix.python }}" ]]; then + if [[ "$actual" != "${{ 3.13 }}" ]]; then echo "Python version in use ($actual) does not match intended version (${{ matrix.python }})" exit 1 fi From edad807b06439a6d25d085faaf11cd59b0163262 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Mon, 31 Mar 2025 10:45:18 -0400 Subject: [PATCH 4/8] Install python on $PATH in addition to in virtualenv --- .github/workflows/ci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7dca234b5..4447ba8b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,13 +45,19 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} - uses: astral-sh/setup-uv@v5 - run: uv tool install poethepoet + - run: uv --preview python install --default ${{ matrix.python }} - run: uv sync --all-extras --python ${{ matrix.python }} - name: Check python version shell: bash run: | + actual=$(uv run python -c "import sys; print('.'.join(map(str, sys.version_info[:2])))") + if [[ "$actual" != "${{ 3.13 }}" ]]; then + echo "Python version in use by uv ($actual) does not match intended version (${{ matrix.python }})" + exit 1 + fi actual=$(python -c "import sys; print('.'.join(map(str, sys.version_info[:2])))") if [[ "$actual" != "${{ 3.13 }}" ]]; then - echo "Python version in use ($actual) does not match intended version (${{ matrix.python }})" + echo "Python version on PATH ($actual) does not match intended version (${{ matrix.python }})" exit 1 fi - run: poe bridge-lint From 86f2bfa0c09b248d935acc7f3c5bbb4324aebecd Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Mon, 31 Mar 2025 10:57:20 -0400 Subject: [PATCH 5/8] Revert "Don't use setup-python action" This reverts commit 47b28becfc223c73292c95b674ce14e75b4eb641. --- .github/workflows/build-binaries.yml | 3 +++ .github/workflows/ci.yml | 3 +++ .github/workflows/run-bench.yml | 3 +++ 3 files changed, 9 insertions(+) diff --git a/.github/workflows/build-binaries.yml b/.github/workflows/build-binaries.yml index 4d8d83145..b585e3bf8 100644 --- a/.github/workflows/build-binaries.yml +++ b/.github/workflows/build-binaries.yml @@ -30,6 +30,9 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - uses: actions/setup-python@v5 + with: + python-version: "3.13" # Install Rust locally for non-Linux (Linux uses an internal docker # command to build with cibuildwheel which uses rustup install defined diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4447ba8b4..25b662c1b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,6 +38,9 @@ jobs: - uses: Swatinem/rust-cache@v2 with: workspaces: temporalio/bridge -> target + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} - uses: arduino/setup-protoc@v3 with: # TODO(cretz): Can upgrade proto when https://github.com/arduino/setup-protoc/issues/99 fixed diff --git a/.github/workflows/run-bench.yml b/.github/workflows/run-bench.yml index ace6034bf..d08c98e93 100644 --- a/.github/workflows/run-bench.yml +++ b/.github/workflows/run-bench.yml @@ -35,6 +35,9 @@ jobs: - uses: Swatinem/rust-cache@v2 with: workspaces: temporalio/bridge -> target + - uses: actions/setup-python@v5 + with: + python-version: "3.13" - uses: arduino/setup-protoc@v3 with: # TODO(cretz): Can upgrade proto when https://github.com/arduino/setup-protoc/issues/99 fixed From 388276db9b48c0382c99d399ed9d10c225af78fd Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Mon, 31 Mar 2025 11:06:36 -0400 Subject: [PATCH 6/8] Don't use uv --preview to install --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 25b662c1b..045d0b685 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,6 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} - uses: astral-sh/setup-uv@v5 - run: uv tool install poethepoet - - run: uv --preview python install --default ${{ matrix.python }} - run: uv sync --all-extras --python ${{ matrix.python }} - name: Check python version shell: bash From 77b27aba2c63ce008d37533deb5428c91dc60617 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Mon, 31 Mar 2025 11:10:38 -0400 Subject: [PATCH 7/8] Revert "Deliberate error" This reverts commit 0778ee8e27ce3e0b0e920a8fe827b19577a16532. --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 045d0b685..a5d32d584 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,12 +53,12 @@ jobs: shell: bash run: | actual=$(uv run python -c "import sys; print('.'.join(map(str, sys.version_info[:2])))") - if [[ "$actual" != "${{ 3.13 }}" ]]; then + if [[ "$actual" != "${{ matrix.python }}" ]]; then echo "Python version in use by uv ($actual) does not match intended version (${{ matrix.python }})" exit 1 fi actual=$(python -c "import sys; print('.'.join(map(str, sys.version_info[:2])))") - if [[ "$actual" != "${{ 3.13 }}" ]]; then + if [[ "$actual" != "${{ matrix.python }}" ]]; then echo "Python version on PATH ($actual) does not match intended version (${{ matrix.python }})" exit 1 fi From 3dc6d6d4e88c71fcc932c30a3c81aec2ab67fa19 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Mon, 31 Mar 2025 12:34:23 -0400 Subject: [PATCH 8/8] Specify python version with `uv sync` --- .github/workflows/ci.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a5d32d584..473c42bec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -97,7 +97,7 @@ jobs: TEMPORAL_TEST_PROTO3: 1 run: | uv add --python 3.9 "protobuf<4" - uv sync --all-extras + uv sync --all-extras --python 3.9 poe build-develop poe gen-protos poe format diff --git a/README.md b/README.md index 58e775da1..1983ed982 100644 --- a/README.md +++ b/README.md @@ -1544,7 +1544,7 @@ poe test -s --log-cli-level=DEBUG -k test_sync_activity_thread_cancel_caught #### Proto Generation and Testing To allow for backwards compatibility, protobuf code is generated on the 3.x series of the protobuf library. To generate -protobuf code, you must be on Python <= 3.10, and then run `uv add "protobuf<4"` + `uv sync --all-extras`. Then the +protobuf code, run `uv add "protobuf<4" --python 3.10` + `uv sync --all-extras --python 3.10`. Then the protobuf files can be generated via `poe gen-protos`. Tests can be run for protobuf version 3 by setting the `TEMPORAL_TEST_PROTO3` env var to `1` prior to running tests.