@@ -1390,28 +1390,27 @@ The Python SDK is built to work with Python 3.9 and newer. It is built using
13901390
13911391To 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 ` :
14021398
1403- With the prerequisites installed, first clone the SDK repository recursively:
1399+ ``` bash
1400+ uv tool install poethepoet
1401+ ```
1402+
1403+ Now clone the SDK repository recursively:
14041404
14051405``` bash
14061406git clone --recursive https://github.com/temporalio/sdk-python.git
14071407cd sdk-python
14081408```
14091409
1410- Use ` poetry ` to install the dependencies with ` --no-root ` to not install this package (because we still need to build
1411- it):
1410+ Install the dependencies:
14121411
14131412``` bash
1414- poetry install --no-root --all-extras
1413+ uv sync --all-extras
14151414```
14161415
14171416#### Build
@@ -1422,16 +1421,11 @@ Now perform the release build:
14221421 environment] ( #local-sdk-development-environment ) for the quicker approach to local development).
14231422
14241423``` bash
1425- poetry build
1424+ uv build
14261425```
14271426
1428- The compiled wheel doesn't have the exact right tags yet for use, so run this script to fix it:
1429-
1430- ``` bash
1431- poe fix-wheel
1432- ```
14331427
1434- The ` whl ` wheel file in ` dist/ ` is now ready to use.
1428+ The ` . whl` wheel file in ` dist/ ` is now ready to use.
14351429
14361430#### Use
14371431
@@ -1487,22 +1481,15 @@ It should output:
14871481
14881482### Local SDK development environment
14891483
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- ```
1484+ For local development, it is quicker to use a debug build.
14981485
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 :
1486+ Perform the same steps as the "Prepare" section above by installing the prerequisites, cloning the project, and
1487+ installing dependencies:
15011488
15021489``` bash
15031490git clone --recursive https://github.com/temporalio/sdk-python.git
15041491cd sdk-python
1505- poetry install --no-root --all-extras
1492+ uv sync --all-extras
15061493```
15071494
15081495Now compile the Rust extension in develop mode which is quicker than release mode:
@@ -1535,14 +1522,14 @@ poe test -s --log-cli-level=DEBUG -k test_sync_activity_thread_cancel_caught
15351522#### Proto Generation and Testing
15361523
15371524To 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
1540- for protobuf version 3 by setting the ` TEMPORAL_TEST_PROTO3 ` env var to ` 1 ` prior to running tests.
1525+ protobuf code, you must be on Python <= 3.10, and then run ` uv add "protobuf<4"` + ` uv sync --all-extras ` . Then the
1526+ protobuf files can be generated via ` poe gen-protos ` . Tests can be run for protobuf version 3 by setting the
1527+ ` TEMPORAL_TEST_PROTO3 ` env var to ` 1 ` prior to running tests.
15411528
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.
1529+ Do not commit ` uv .lock` or ` pyproject.toml ` changes. To go back from this downgrade, restore both of those files and run
1530+ ` uv sync --all-extras` . Make sure you ` poe format ` the results.
15441531
1545- For a less system-intrusive approach, you can (note this approach [ may have a bug ] ( https://github.com/temporalio/sdk-python/issues/543 ) ) :
1532+ For a less system-intrusive approach, you can:
15461533``` shell
15471534docker build -f scripts/_proto/Dockerfile .
15481535docker run --rm -v " ${PWD} /temporalio/api:/api_new" -v " ${PWD} /temporalio/bridge/proto:/bridge_new" < just built image sha>
@@ -1552,7 +1539,7 @@ poe format
15521539### Style
15531540
15541541* 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
1542+ * We use [ ruff ] ( https://docs.astral.sh/ruff/ ) for formatting, so that takes precedence
15561543 * In tests and example code, can import individual classes/functions to make it more readable. Can also do this for
15571544 rarely in library code for some Python common items (e.g. ` dataclass ` or ` partial ` ), but not allowed to do this for
15581545 any ` temporalio ` packages (except ` temporalio.types ` ) or any classes/functions that aren't clear when unqualified.
0 commit comments