@@ -1390,28 +1390,26 @@ The Python SDK is built to work with Python 3.9 and newer. It is built using
1390
1390
1391
1391
To build the SDK from source for use as a dependency, the following prerequisites are required:
1392
1392
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/ )
1395
1394
* [ Rust] ( https://www.rust-lang.org/ )
1396
1395
* [ 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 ` )
1399
1396
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
+ ```
1402
1401
1403
- With the prerequisites installed, first clone the SDK repository recursively:
1402
+ Now clone the SDK repository recursively:
1404
1403
1405
1404
``` bash
1406
1405
git clone --recursive https://github.com/temporalio/sdk-python.git
1407
1406
cd sdk-python
1408
1407
```
1409
1408
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):
1412
1410
1413
1411
``` bash
1414
- poetry install --no-root --all-extras
1412
+ uv sync --no-install-project --all-extras
1415
1413
```
1416
1414
1417
1415
#### Build
@@ -1487,22 +1485,15 @@ It should output:
1487
1485
1488
1486
### Local SDK development environment
1489
1487
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.
1498
1489
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:
1501
1492
1502
1493
``` bash
1503
1494
git clone --recursive https://github.com/temporalio/sdk-python.git
1504
1495
cd sdk-python
1505
- poetry install --no-root --all-extras
1496
+ uv sync --no-install-project --all-extras
1506
1497
```
1507
1498
1508
1499
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
1535
1526
#### Proto Generation and Testing
1536
1527
1537
1528
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
1540
1531
for protobuf version 3 by setting the ` TEMPORAL_TEST_PROTO3 ` env var to ` 1 ` prior to running tests.
1541
1532
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.
1544
1535
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:
1546
1537
``` shell
1547
1538
docker build -f scripts/_proto/Dockerfile .
1548
1539
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
1552
1543
### Style
1553
1544
1554
1545
* 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
1556
1547
* In tests and example code, can import individual classes/functions to make it more readable. Can also do this for
1557
1548
rarely in library code for some Python common items (e.g. ` dataclass ` or ` partial ` ), but not allowed to do this for
1558
1549
any ` temporalio ` packages (except ` temporalio.types ` ) or any classes/functions that aren't clear when unqualified.
0 commit comments