Skip to content

Commit 06cfd03

Browse files
authored
Drop Python 3.7 support, ensure 3.12 support, update dependencies, and implement asyncio.timeout (#422)
1 parent 4e0883e commit 06cfd03

File tree

15 files changed

+407
-236
lines changed

15 files changed

+407
-236
lines changed

.github/workflows/build-binaries.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ jobs:
3232
- if: ${{ !endsWith(matrix.os, '-arm') }}
3333
uses: actions/setup-python@v4
3434
with:
35-
python-version: "3.11"
35+
python-version: "3.12"
3636
- if: ${{ matrix.os == 'ubuntu-arm' }}
3737
uses: deadsnakes/action@v2.1.1
3838
with:
39-
python-version: "3.11"
39+
python-version: "3.12"
4040

4141
# Install Rust locally for non-Linux (Linux uses an internal docker
4242
# command to build with cibuildwheel which uses rustup install defined
@@ -55,7 +55,7 @@ jobs:
5555
# https://github.com/python-poetry/poetry/issues/7611 and
5656
# https://github.com/python-poetry/poetry/pull/7694 are fixed
5757
- run: python -m pip install --upgrade wheel "poetry==1.3.2" poethepoet
58-
- run: poetry install --no-root -E opentelemetry
58+
- run: poetry install --no-root --all-extras
5959

6060
# Add the source dist only for Linux x64 for now
6161
- if: ${{ matrix.package-suffix == 'linux-amd64' }}

.github/workflows/ci.yml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,18 @@ jobs:
1212
strategy:
1313
fail-fast: true
1414
matrix:
15-
python: ["3.7", "3.11"]
15+
python: ["3.8", "3.12"]
1616
os: [ubuntu-latest, macos-latest, windows-latest, ubuntu-arm]
1717
include:
1818
- os: ubuntu-latest
19-
python: "3.11"
19+
python: "3.12"
2020
docsTarget: true
2121
- os: ubuntu-latest
22-
python: "3.7"
22+
python: "3.8"
2323
protoCheckTarget: true
2424
- os: ubuntu-arm
2525
runsOn: buildjet-4vcpu-ubuntu-2204-arm
2626
runs-on: ${{ matrix.runsOn || matrix.os }}
27-
# For Windows there is currently a bug with Windows + pytest + warnings +
28-
# importlib + Python < 3.12. Based on others' investigations, disabling
29-
# bytecode fixes it.
30-
# See https://github.com/temporalio/sdk-python/pull/346#issuecomment-1636108747
31-
env:
32-
PYTHONDONTWRITEBYTECODE: "${{ matrix.os == 'windows-latest' && '1' || '' }}"
3327
steps:
3428
- uses: actions/checkout@v2
3529
with:
@@ -44,9 +38,7 @@ jobs:
4438
- if: ${{ !endsWith(matrix.os, '-arm') }}
4539
uses: actions/setup-python@v4
4640
with:
47-
# Due to a yet-uninvestigated change in 3.11.6 that breaks the Rust
48-
# linker on Windows, we are pinning 3.11 to 3.11.5 here
49-
python-version: ${{ matrix.python == '3.11' && '3.11.5' || matrix.python }}
41+
python-version: ${{ matrix.python }}
5042
- if: ${{ matrix.os == 'ubuntu-arm' }}
5143
uses: deadsnakes/action@v2.1.1
5244
with:
@@ -55,7 +47,7 @@ jobs:
5547
# https://github.com/python-poetry/poetry/issues/7611 and
5648
# https://github.com/python-poetry/poetry/pull/7694 are fixed
5749
- run: python -m pip install --upgrade wheel "poetry==1.3.2" poethepoet
58-
- run: poetry install --no-root -E opentelemetry
50+
- run: poetry install --no-root --all-extras
5951
- run: poe lint
6052
- run: poe build-develop
6153
- run: poe test -s -o log_cli_level=DEBUG

.github/workflows/run-bench.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ jobs:
3737
working-directory: temporalio/bridge
3838
- uses: actions/setup-python@v4
3939
with:
40-
python-version: "3.11"
40+
python-version: "3.12"
4141

4242
# Build
4343
- run: python -m pip install --upgrade wheel poetry poethepoet
44-
- run: poetry install --no-root -E opentelemetry
44+
- run: poetry install --no-root --all-extras
4545
- run: poe build-develop-with-release
4646

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

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![Temporal Python SDK](https://assets.temporal.io/w/py-banner.svg)
22

3-
[![Python 3.7+](https://img.shields.io/pypi/pyversions/temporalio.svg?style=for-the-badge)](https://pypi.org/project/temporalio)
3+
[![Python 3.8+](https://img.shields.io/pypi/pyversions/temporalio.svg?style=for-the-badge)](https://pypi.org/project/temporalio)
44
[![PyPI](https://img.shields.io/pypi/v/temporalio.svg?style=for-the-badge)](https://pypi.org/project/temporalio)
55
[![MIT](https://img.shields.io/pypi/l/temporalio.svg?style=for-the-badge)](LICENSE)
66

@@ -668,6 +668,9 @@ Some things to note about the above code:
668668
* A timer is represented by normal `asyncio.sleep()`
669669
* Timers are also implicitly started on any `asyncio` calls with timeouts (e.g. `asyncio.wait_for`)
670670
* Timers are Temporal server timers, not local ones, so sub-second resolution rarely has value
671+
* Calls that use a specific point in time, e.g. `call_at` or `timeout_at`, should be based on the current loop time
672+
(i.e. `workflow.time()`) and not an actual point in time. This is because fixed times are translated to relative ones
673+
by subtracting the current loop time which may not be the actual current time.
671674

672675
#### Conditions
673676

@@ -683,7 +686,6 @@ of the common `asyncio` calls work as normal. Some asyncio features are disabled
683686
* Thread related calls such as `to_thread()`, `run_coroutine_threadsafe()`, `loop.run_in_executor()`, etc
684687
* Calls that alter the event loop such as `loop.close()`, `loop.stop()`, `loop.run_forever()`,
685688
`loop.set_task_factory()`, etc
686-
* Calls that use a specific time such as `loop.call_at()`
687689
* Calls that use anything external such as networking, subprocesses, disk IO, etc
688690

689691
Cancellation is done the same way as `asyncio`. Specifically, a task can be requested to be cancelled but does not
@@ -1295,7 +1297,7 @@ users are encouraged to not use gevent in asyncio applications (including Tempor
12951297

12961298
# Development
12971299

1298-
The Python SDK is built to work with Python 3.7 and newer. It is built using
1300+
The Python SDK is built to work with Python 3.8 and newer. It is built using
12991301
[SDK Core](https://github.com/temporalio/sdk-core/) which is written in Rust.
13001302

13011303
### Building
@@ -1304,7 +1306,7 @@ The Python SDK is built to work with Python 3.7 and newer. It is built using
13041306

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

1307-
* [Python](https://www.python.org/) >= 3.7
1309+
* [Python](https://www.python.org/) >= 3.8
13081310
* [Rust](https://www.rust-lang.org/)
13091311
* [poetry](https://github.com/python-poetry/poetry) (e.g. `python -m pip install poetry`)
13101312
* [poe](https://github.com/nat-n/poethepoet) (e.g. `python -m pip install poethepoet`)

build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def build(setup_kwargs):
1616
path="temporalio/bridge/Cargo.toml",
1717
binding=Binding.PyO3,
1818
py_limited_api=True,
19-
features=["pyo3/abi3-py37"],
19+
features=["pyo3/abi3-py38"],
2020
)
2121
],
2222
zip_safe=False,

0 commit comments

Comments
 (0)