From 721520999ec542cb03c940411bd920d04c2b6ac0 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Sat, 10 Oct 2026 19:08:07 +0200 Subject: [PATCH 1/3] build: Require Python 3.11 --- .github/workflows/ci.yml | 3 --- AGENTS.md | 2 +- README.md | 2 +- docs/index.md | 2 +- examples/basic.py | 2 +- examples/cooperation.py | 2 +- examples/deadlock.py | 2 +- examples/proxy.py | 2 +- examples/worker_pool.py | 2 +- pyproject.toml | 8 ++------ 10 files changed, 10 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 34debe8c..eb06eedc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,9 +27,6 @@ jobs: - name: "Docs" python: "3.15" tox: docs - - name: "pytest (3.10)" - python: "3.10" - tox: "3.10" - name: "pytest (3.11)" python: "3.11" tox: "3.11" diff --git a/AGENTS.md b/AGENTS.md index 2434ecb5..ab98111a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,7 +2,7 @@ Guidance for coding agents that work in this repo. -Pykka is a Python implementation of the actor model. It supports Python 3.10 +Pykka is a Python implementation of the actor model. It supports Python 3.11 and newer, and has no runtime dependencies. ## Layout diff --git a/README.md b/README.md index 224d54ff..12a9b2d3 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ which makes it easier to build concurrent applications. ## Installation -Pykka has no dependencies other than Python 3.10 or newer. +Pykka has no dependencies other than Python 3.11 or newer. It can be installed from [PyPI](https://pypi.org/project/pykka/): ```console diff --git a/docs/index.md b/docs/index.md index 32b20aed..5f4ef323 100644 --- a/docs/index.md +++ b/docs/index.md @@ -9,7 +9,7 @@ applications. ## Installation -Pykka has no dependencies other than Python 3.10 or newer. +Pykka has no dependencies other than Python 3.11 or newer. It can be installed from [PyPI](https://pypi.org/project/pykka/): ```console diff --git a/examples/basic.py b/examples/basic.py index f0894d93..e3f037ba 100755 --- a/examples/basic.py +++ b/examples/basic.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # /// script -# requires-python = ">=3.10" +# requires-python = ">=3.11" # dependencies = [ # "pykka", # ] diff --git a/examples/cooperation.py b/examples/cooperation.py index cb48fe9b..545fb24d 100755 --- a/examples/cooperation.py +++ b/examples/cooperation.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # /// script -# requires-python = ">=3.10" +# requires-python = ">=3.11" # dependencies = [ # "pykka", # ] diff --git a/examples/deadlock.py b/examples/deadlock.py index 0d5351e8..0e04adb0 100755 --- a/examples/deadlock.py +++ b/examples/deadlock.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # /// script -# requires-python = ">=3.10" +# requires-python = ">=3.11" # dependencies = [ # "pykka", # ] diff --git a/examples/proxy.py b/examples/proxy.py index 69e771af..29fc8c2c 100755 --- a/examples/proxy.py +++ b/examples/proxy.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # /// script -# requires-python = ">=3.10" +# requires-python = ">=3.11" # dependencies = [ # "pykka", # ] diff --git a/examples/worker_pool.py b/examples/worker_pool.py index 9d743caf..976610a5 100755 --- a/examples/worker_pool.py +++ b/examples/worker_pool.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # /// script -# requires-python = ">=3.10" +# requires-python = ">=3.11" # dependencies = [ # "pykka", # ] diff --git a/pyproject.toml b/pyproject.toml index b3542a61..dc011826 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "pykka" version = "4.4.2" description = "Pykka is a Python implementation of the actor model" authors = [{ name = "Stein Magnus Jodal", email = "stein.magnus@jodal.no" }] -requires-python = ">=3.10" +requires-python = ">=3.11" readme = "README.md" license = "Apache-2.0" keywords = ["actor", "concurrency", "threading"] @@ -75,7 +75,7 @@ ignore_missing_imports = true [tool.pyright] -pythonVersion = "3.10" +pythonVersion = "3.11" typeCheckingMode = "strict" # Already coverd by tests and careful import ordering: reportImportCycles = false @@ -83,9 +83,6 @@ reportImportCycles = false reportPrivateUsage = false -[tool.ruff] -target-version = "py310" - [tool.ruff.lint] select = ["ALL"] ignore = [ @@ -136,7 +133,6 @@ keep-runtime-typing = true [tool.tox] env_list = [ - "3.10", "3.11", "3.12", "3.13", From 66e5db9a277bdcbe30e8b112a9e36d09575a1aa7 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Sat, 10 Oct 2026 19:08:10 +0200 Subject: [PATCH 2/3] refactor: Use Self in Actor type hints --- pyproject.toml | 1 - src/pykka/_actor.py | 11 ++++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index dc011826..0aae574b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -93,7 +93,6 @@ ignore = [ "D213", # multi-line-summary-second-line "G004", # logging-f-string "PLR2004", # magic-value-comparison - "PYI019", # custom-type-var-for-self -- Remove when requiring Python 3.11 "RET504", # unnecessary-assign "S101", # assert "TRY003", # raise-vanilla-args diff --git a/src/pykka/_actor.py b/src/pykka/_actor.py index 6ff0bd0b..5c7c2b73 100644 --- a/src/pykka/_actor.py +++ b/src/pykka/_actor.py @@ -5,7 +5,7 @@ import sys import threading import uuid -from typing import TYPE_CHECKING, Any, Protocol, TypeVar +from typing import TYPE_CHECKING, Any, Protocol, Self from pykka import ActorDeadError, ActorRef, ActorRegistry, messages from pykka._introspection import get_attr_directly @@ -22,9 +22,6 @@ logger = logging.getLogger("pykka") -A = TypeVar("A", bound="Actor") - - class ActorInbox(Protocol): def put(self, envelope: Envelope[Any], /) -> None: ... @@ -81,10 +78,10 @@ def a_method(self, ...): @classmethod def start( - cls: type[A], + cls, *args: Any, **kwargs: Any, - ) -> ActorRef[A]: + ) -> ActorRef[Self]: """Start an actor. Starting an actor also registers it in the @@ -174,7 +171,7 @@ def _start_actor_loop(self) -> None: _actor_ref: ActorRef[Any] @property - def actor_ref(self: A) -> ActorRef[A]: + def actor_ref(self) -> ActorRef[Self]: """The actor's [`ActorRef`][pykka.ActorRef] instance.""" # This property only exists to improve the typing of the ActorRef. return self._actor_ref From 03542a6ccf3d98fe5ec2a921dbb8e384553074a6 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Sat, 10 Oct 2026 19:08:43 +0200 Subject: [PATCH 3/3] test: Use StrEnum for log levels --- tests/log_handler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/log_handler.py b/tests/log_handler.py index 54b2a08f..f0a297ff 100644 --- a/tests/log_handler.py +++ b/tests/log_handler.py @@ -2,11 +2,11 @@ import logging import threading import time -from enum import Enum +from enum import StrEnum from typing import Any -class LogLevel(str, Enum): +class LogLevel(StrEnum): DEBUG = "debug" INFO = "info" WARNING = "warning"