Skip to content

Commit

Permalink
chore: remove Python < 3.9 support (#728) (#730)
Browse files Browse the repository at this point in the history
* chore: remove Python < 3.9 logic and update dependencies (#728)

- Bump the minimum supported Python version from 3.8 to 3.9
- Remove macOS-specific code for Python < 3.8
- Update references in README, build.py, and poetry.lock accordingly

Closes #728

* rollback poetry.lock file

* fixed code formatting
  • Loading branch information
ozeranskii authored Jan 24, 2025
1 parent 044b1de commit 07d3567
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1373,7 +1373,7 @@ users are encouraged to not use gevent in asyncio applications (including Tempor

# Development

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

### Building
Expand Down
2 changes: 1 addition & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def build(setup_kwargs):
path="temporalio/bridge/Cargo.toml",
binding=Binding.PyO3,
py_limited_api=True,
features=["pyo3/abi3-py38"],
features=["pyo3/abi3-py39"],
)
],
zip_safe=False,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ exclude = [
]

[tool.ruff]
target-version = "py38"
target-version = "py39"

[build-system]
build-backend = "poetry.core.masonry.api"
Expand Down
6 changes: 0 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@
from temporalio.testing import WorkflowEnvironment
from tests.helpers.worker import ExternalPythonWorker, ExternalWorker

# Due to https://github.com/python/cpython/issues/77906, multiprocessing on
# macOS starting with Python 3.8 has changed from "fork" to "spawn". For
# pre-3.8, we are changing it for them.
if sys.version_info < (3, 8) and sys.platform.startswith("darwin"):
multiprocessing.set_start_method("spawn", True)


def pytest_addoption(parser):
parser.addoption(
Expand Down
40 changes: 25 additions & 15 deletions tests/worker/test_replayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,11 @@ async def test_replayer_workflow_nondeterministic(client: Client) -> None:


async def test_replayer_workflow_nondeterministic_json() -> None:
with Path(__file__).with_name("test_replayer_nondeterministic_history.json").open(
"r"
) as f:
with (
Path(__file__)
.with_name("test_replayer_nondeterministic_history.json")
.open("r") as f
):
history_json = f.read()
with pytest.raises(workflow.NondeterminismError):
await Replayer(workflows=[SayHelloWorkflow]).replay_workflow(
Expand All @@ -184,9 +186,11 @@ async def test_replayer_workflow_nondeterministic_json() -> None:
async def test_replayer_multiple_histories_fail_fast() -> None:
with Path(__file__).with_name("test_replayer_complete_history.json").open("r") as f:
history_json = f.read()
with Path(__file__).with_name("test_replayer_nondeterministic_history.json").open(
"r"
) as f:
with (
Path(__file__)
.with_name("test_replayer_nondeterministic_history.json")
.open("r") as f
):
history_json_bad = f.read()

callcount = 0
Expand All @@ -210,9 +214,11 @@ async def histories():
async def test_replayer_multiple_histories_fail_slow() -> None:
with Path(__file__).with_name("test_replayer_complete_history.json").open("r") as f:
history_json = f.read()
with Path(__file__).with_name("test_replayer_nondeterministic_history.json").open(
"r"
) as f:
with (
Path(__file__)
.with_name("test_replayer_nondeterministic_history.json")
.open("r") as f
):
history_json_bad = f.read()

callcount = 0
Expand Down Expand Up @@ -389,9 +395,11 @@ async def test_replayer_command_reordering_backward_compatibility() -> None:
to [UpdateAccepted, CompleteWorkflowExecution], and events 5 and 6 can be applied to the
corresponding state machines.
"""
with Path(__file__).with_name(
"test_replayer_command_reordering_backward_compatibility.json"
).open() as f:
with (
Path(__file__)
.with_name("test_replayer_command_reordering_backward_compatibility.json")
.open() as f
):
history = f.read()
await Replayer(workflows=[UpdateCompletionAfterWorkflowReturn]).replay_workflow(
WorkflowHistory.from_json("fake", history)
Expand Down Expand Up @@ -475,9 +483,11 @@ async def test_replayer_async_ordering() -> None:


async def test_replayer_alternate_async_ordering() -> None:
with Path(__file__).with_name(
"test_replayer_event_tracing_alternate.json"
).open() as f:
with (
Path(__file__)
.with_name("test_replayer_event_tracing_alternate.json")
.open() as f
):
history = f.read()
await Replayer(
workflows=[ActivityAndSignalsWhileWorkflowDown],
Expand Down

0 comments on commit 07d3567

Please sign in to comment.