Skip to content

Commit 0dd9410

Browse files
committed
Migrate CI and README
1 parent 0bd94a9 commit 0dd9410

File tree

5 files changed

+33
-39
lines changed

5 files changed

+33
-39
lines changed

.github/workflows/build-binaries.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,20 @@ jobs:
4343
uses: Swatinem/rust-cache@v2
4444
with:
4545
workspaces: temporalio/bridge -> target
46-
46+
- uses: astral-sh/setup-uv@v5
4747
# Prepare
4848
# Using fixed Poetry version until
4949
# https://github.com/python-poetry/poetry/issues/7611 and
5050
# https://github.com/python-poetry/poetry/pull/7694 are fixed
5151
- run: python -m pip install --upgrade wheel "poetry==1.3.2" poethepoet
52-
- run: poetry install --no-root --all-extras
52+
- run: uv sync --no-install-project --all-extras
5353

5454
# Add the source dist only for Linux x64 for now
5555
- if: ${{ matrix.package-suffix == 'linux-amd64' }}
5656
run: poetry build --format sdist
5757

5858
# Build and fix the wheel
59-
- run: poetry run cibuildwheel --output-dir dist
59+
- run: uv run cibuildwheel --output-dir dist
6060
- run: poe fix-wheel
6161

6262
# Simple test

.github/workflows/ci.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ jobs:
4646
# TODO(cretz): Can upgrade proto when https://github.com/arduino/setup-protoc/issues/99 fixed
4747
version: "23.x"
4848
repo-token: ${{ secrets.GITHUB_TOKEN }}
49-
- run: python -m pip install --upgrade wheel poetry poethepoet
50-
- run: poetry install --no-root --all-extras
49+
- uses: astral-sh/setup-uv@v5
50+
- run: python -m pip install --upgrade wheel poethepoet
51+
- run: uv sync --no-install-project --all-extras
5152
- run: poe bridge-lint
5253
if: ${{ matrix.clippyLinter }}
5354
- run: poe lint
@@ -82,8 +83,8 @@ jobs:
8283
env:
8384
TEMPORAL_TEST_PROTO3: 1
8485
run: |
85-
poetry add --python 3.9 "protobuf<4"
86-
poetry install --no-root --all-extras
86+
uv add --python 3.9 "protobuf<4"
87+
uv sync --no-install-project --all-extras
8788
poe gen-protos
8889
poe format
8990
[[ -z $(git status --porcelain temporalio) ]] || (git diff temporalio; echo "Protos changed"; exit 1)

.github/workflows/run-bench.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ jobs:
4444
version: "23.x"
4545
repo-token: ${{ secrets.GITHUB_TOKEN }}
4646

47+
- uses: astral-sh/setup-uv@v5
4748
# Build
48-
- run: python -m pip install --upgrade wheel poetry poethepoet
49-
- run: poetry install --no-root --all-extras
49+
- run: python -m pip install --upgrade wheel poethepoet
50+
- run: uv sync --no-install-project --all-extras
5051
- run: poe build-develop-with-release
5152

5253
# Run a bunch of bench tests. We run multiple times since results vary.

README.md

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,28 +1390,26 @@ The Python SDK is built to work with Python 3.9 and newer. It is built using
13901390

13911391
To build the SDK from source for use as a dependency, the following prerequisites are required:
13921392

1393-
* [Python](https://www.python.org/) >= 3.9
1394-
* Make sure the latest version of `pip` is in use
1393+
* [uv](https://docs.astral.sh/uv/)
13951394
* [Rust](https://www.rust-lang.org/)
13961395
* [Protobuf Compiler](https://protobuf.dev/)
1397-
* [poetry](https://github.com/python-poetry/poetry) (e.g. `python -m pip install poetry`)
1398-
* [poe](https://github.com/nat-n/poethepoet) (e.g. `python -m pip install poethepoet`)
13991396

1400-
macOS note: If errors are encountered, it may be better to install Python and Rust as recommended from their websites
1401-
instead of via `brew`.
1397+
Use `uv` to install `poe`:
1398+
```bash
1399+
uv tool install poethepoet
1400+
```
14021401

1403-
With the prerequisites installed, first clone the SDK repository recursively:
1402+
Now clone the SDK repository recursively:
14041403

14051404
```bash
14061405
git clone --recursive https://github.com/temporalio/sdk-python.git
14071406
cd sdk-python
14081407
```
14091408

1410-
Use `poetry` to install the dependencies with `--no-root` to not install this package (because we still need to build
1411-
it):
1409+
Install the dependencies (`--no-install-project` because we will build it in the next step):
14121410

14131411
```bash
1414-
poetry install --no-root --all-extras
1412+
uv sync --no-install-project --all-extras
14151413
```
14161414

14171415
#### Build
@@ -1487,22 +1485,15 @@ It should output:
14871485

14881486
### Local SDK development environment
14891487

1490-
For local development, it is often quicker to use debug builds and a local virtual environment.
1491-
1492-
While not required, it often helps IDEs if we put the virtual environment `.venv` directory in the project itself. This
1493-
can be configured system-wide via:
1494-
1495-
```bash
1496-
poetry config virtualenvs.in-project true
1497-
```
1488+
For local development, it is quicker to use a debug build.
14981489

1499-
Now perform the same steps as the "Prepare" section above by installing the prerequisites, cloning the project,
1500-
installing dependencies, and generating the protobuf code:
1490+
Perform the same steps as the "Prepare" section above by installing the prerequisites, cloning the project, and
1491+
installing dependencies:
15011492

15021493
```bash
15031494
git clone --recursive https://github.com/temporalio/sdk-python.git
15041495
cd sdk-python
1505-
poetry install --no-root --all-extras
1496+
uv sync --no-install-project --all-extras
15061497
```
15071498

15081499
Now compile the Rust extension in develop mode which is quicker than release mode:
@@ -1535,14 +1526,14 @@ poe test -s --log-cli-level=DEBUG -k test_sync_activity_thread_cancel_caught
15351526
#### Proto Generation and Testing
15361527

15371528
To allow for backwards compatibility, protobuf code is generated on the 3.x series of the protobuf library. To generate
1538-
protobuf code, you must be on Python <= 3.10, and then run `poetry add "protobuf<4"` +
1539-
`poetry install --no-root --all-extras`. Then the protobuf files can be generated via `poe gen-protos`. Tests can be run
1529+
protobuf code, you must be on Python <= 3.10, and then run `uv add "protobuf<4"` +
1530+
`uv sync --no-install-project --all-extras`. Then the protobuf files can be generated via `poe gen-protos`. Tests can be run
15401531
for protobuf version 3 by setting the `TEMPORAL_TEST_PROTO3` env var to `1` prior to running tests.
15411532

1542-
Do not commit `poetry.lock` or `pyproject.toml` changes. To go back from this downgrade, restore both of those files
1543-
and run `poetry install --no-root --all-extras`. Make sure you `poe format` the results.
1533+
Do not commit `uv.lock` or `pyproject.toml` changes. To go back from this downgrade, restore both of those files
1534+
and run `uv sync --no-install-project --all-extras`. Make sure you `poe format` the results.
15441535

1545-
For a less system-intrusive approach, you can (note this approach [may have a bug](https://github.com/temporalio/sdk-python/issues/543)):
1536+
For a less system-intrusive approach, you can:
15461537
```shell
15471538
docker build -f scripts/_proto/Dockerfile .
15481539
docker run --rm -v "${PWD}/temporalio/api:/api_new" -v "${PWD}/temporalio/bridge/proto:/bridge_new" <just built image sha>
@@ -1552,7 +1543,7 @@ poe format
15521543
### Style
15531544

15541545
* Mostly [Google Style Guide](https://google.github.io/styleguide/pyguide.html). Notable exceptions:
1555-
* We use [Black](https://github.com/psf/black) for formatting, so that takes precedence
1546+
* We use [ruff](https://docs.astral.sh/ruff/) for formatting, so that takes precedence
15561547
* In tests and example code, can import individual classes/functions to make it more readable. Can also do this for
15571548
rarely in library code for some Python common items (e.g. `dataclass` or `partial`), but not allowed to do this for
15581549
any `temporalio` packages (except `temporalio.types`) or any classes/functions that aren't clear when unqualified.

scripts/_proto/Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
FROM python:3.10
22

3-
RUN python -m pip install --upgrade wheel "poetry==1.3.2" poethepoet
3+
RUN python -m pip install --upgrade wheel poethepoet
4+
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
45
VOLUME ["/api_new", "/bridge_new"]
56

67
COPY ./ ./
78

89
RUN mkdir -p ./temporalio/api
9-
RUN poetry install --no-root -E opentelemetry
10-
RUN poetry add "protobuf<4"
10+
RUN uv sync --no-install-project --all-extras
11+
RUN uv add "protobuf<4"
1112
RUN poe gen-protos
1213

1314
CMD cp -r ./temporalio/api/* /api_new && cp -r ./temporalio/bridge/proto/* /bridge_new

0 commit comments

Comments
 (0)