Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require Python 3.9+ #220

Merged
merged 3 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ jobs:
fail-fast: false
matrix:
include:
- name: "Test: Python 3.8"
python: "3.8"
tox: py38
- name: "Test: Python 3.9"
python: "3.9"
tox: py39
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ classifiers = [
include = ["docs", "examples", "tests"]

[tool.poetry.dependencies]
python = "^3.8.0"
python = "^3.9.0"
typing-extensions = { version = "^4.0.0", python = "<3.10" }

[tool.poetry.group.dev.dependencies]
Expand Down Expand Up @@ -62,7 +62,7 @@ warn_unused_ignores = true
warn_unused_configs = true

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

[tool.ruff.lint]
select = ["ALL"]
Expand Down Expand Up @@ -112,7 +112,7 @@ known-first-party = ["pykka"]
keep-runtime-typing = true

[tool.pyright]
pythonVersion = "3.8"
pythonVersion = "3.9"
venvPath = "."
venv = ".venv"
typeCheckingMode = "strict"
Expand Down
3 changes: 1 addition & 2 deletions src/pykka/_future.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from __future__ import annotations

import functools
from collections.abc import Generator, Iterable
from typing import (
TYPE_CHECKING,
Any,
Callable,
Generator,
Generic,
Iterable,
Optional,
TypeVar,
cast,
Expand Down
8 changes: 4 additions & 4 deletions src/pykka/_types.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
from __future__ import annotations

from types import TracebackType
from typing import TYPE_CHECKING, Optional, Tuple, Type
from typing import TYPE_CHECKING, Optional

Check warning on line 4 in src/pykka/_types.py

View check run for this annotation

Codecov / codecov/patch

src/pykka/_types.py#L4

Added line #L4 was not covered by tests

if TYPE_CHECKING:
from typing_extensions import TypeAlias


AttrPath: TypeAlias = Tuple[str, ...]
AttrPath: TypeAlias = tuple[str, ...]


# OptExcInfo matches the return type of sys.exc_info() in typeshed
OptExcInfo = Tuple[
Optional[Type[BaseException]],
OptExcInfo = tuple[

Check warning on line 14 in src/pykka/_types.py

View check run for this annotation

Codecov / codecov/patch

src/pykka/_types.py#L14

Added line #L14 was not covered by tests
Optional[type[BaseException]],
Optional[BaseException],
Optional[TracebackType],
]
6 changes: 3 additions & 3 deletions src/pykka/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

from __future__ import annotations

from typing import TYPE_CHECKING, Any, Dict, NamedTuple, Tuple
from typing import TYPE_CHECKING, Any, NamedTuple

if TYPE_CHECKING:
from pykka._types import AttrPath
Expand All @@ -43,10 +43,10 @@ class ProxyCall(NamedTuple):
attr_path: AttrPath

#: List with positional arguments.
args: Tuple[Any, ...]
args: tuple[Any, ...]

#: Dict with keyword arguments.
kwargs: Dict[str, Any]
kwargs: dict[str, Any]


class ProxyGetAttr(NamedTuple):
Expand Down
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from typing import (
TYPE_CHECKING,
Any,
Iterator,
cast,
)

Expand All @@ -17,6 +16,8 @@
from tests.types import Events, Runtime

if TYPE_CHECKING:
from collections.abc import Iterator

from pykka import Actor, Future


Expand Down
6 changes: 3 additions & 3 deletions tests/log_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import threading
import time
from enum import Enum
from typing import Any, Dict, List
from typing import Any


class LogLevel(str, Enum):
Expand All @@ -16,8 +16,8 @@ class LogLevel(str, Enum):

class PykkaTestLogHandler(logging.Handler):
lock: threading.RLock # type: ignore[assignment]
events: Dict[str, threading.Event]
messages: Dict[LogLevel, List[logging.LogRecord]]
events: dict[str, threading.Event]
messages: dict[LogLevel, list[logging.LogRecord]]

def __init__(self, *args: Any, **kwargs: Any) -> None:
self.lock = ( # pyright: ignore[reportIncompatibleVariableOverride]
Expand Down
4 changes: 3 additions & 1 deletion tests/proxy/test_attribute_access.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from __future__ import annotations

from typing import TYPE_CHECKING, Iterator, NoReturn
from typing import TYPE_CHECKING, NoReturn

import pytest

from pykka import Actor

if TYPE_CHECKING:
from collections.abc import Iterator

from pykka import ActorProxy
from tests.types import Runtime

Expand Down
4 changes: 3 additions & 1 deletion tests/proxy/test_dynamic_method_calls.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from __future__ import annotations

from typing import TYPE_CHECKING, Iterator
from typing import TYPE_CHECKING

import pytest

from pykka import Actor

if TYPE_CHECKING:
from collections.abc import Iterator

from pykka import ActorProxy, Future
from tests.types import Runtime

Expand Down
4 changes: 3 additions & 1 deletion tests/proxy/test_mocking.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from __future__ import annotations

from typing import TYPE_CHECKING, Iterator, NoReturn
from typing import TYPE_CHECKING, NoReturn

import pytest

from pykka import Actor

if TYPE_CHECKING:
from collections.abc import Iterator

from pytest_mock import MockerFixture

from pykka import ActorProxy
Expand Down
4 changes: 3 additions & 1 deletion tests/proxy/test_proxy.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import TYPE_CHECKING, Iterator
from typing import TYPE_CHECKING

import pytest

Expand All @@ -9,6 +9,8 @@
from tests.log_handler import LogLevel, PykkaTestLogHandler

if TYPE_CHECKING:
from collections.abc import Iterator

from tests.types import Runtime


Expand Down
4 changes: 3 additions & 1 deletion tests/proxy/test_static_method_calls.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from __future__ import annotations

from typing import TYPE_CHECKING, Any, Iterator, NoReturn
from typing import TYPE_CHECKING, Any, NoReturn

import pytest

from pykka import Actor

if TYPE_CHECKING:
from collections.abc import Iterator

from pykka import ActorProxy, Future
from tests.types import Events, Runtime

Expand Down
4 changes: 3 additions & 1 deletion tests/proxy/test_traversable.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
from __future__ import annotations

from typing import TYPE_CHECKING, Iterator
from typing import TYPE_CHECKING

import pytest

import pykka
from pykka import Actor

if TYPE_CHECKING:
from collections.abc import Iterator

from pykka import ActorProxy
from tests.types import Runtime

Expand Down
4 changes: 3 additions & 1 deletion tests/proxy/test_typed_proxy.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from dataclasses import dataclass
from typing import TYPE_CHECKING, Iterator, cast
from typing import TYPE_CHECKING, cast

import pytest

Expand All @@ -10,6 +10,8 @@
from pykka.typing import ActorMemberMixin, proxy_field, proxy_method

if TYPE_CHECKING:
from collections.abc import Iterator

from tests.types import Runtime


Expand Down
4 changes: 3 additions & 1 deletion tests/test_actor.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
from __future__ import annotations

import uuid
from typing import TYPE_CHECKING, Any, Iterator
from typing import TYPE_CHECKING, Any

import pytest

from pykka import Actor, ActorDeadError, ActorRegistry

if TYPE_CHECKING:
from collections.abc import Iterator

from pykka import ActorRef
from tests.types import Events, Runtime

Expand Down
8 changes: 5 additions & 3 deletions tests/test_future.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
import sys
import traceback
import types
from typing import TYPE_CHECKING, Any, Generator, Iterable, List
from typing import TYPE_CHECKING, Any

import pytest

from pykka import Future, Timeout, get_all

if TYPE_CHECKING:
from collections.abc import Generator, Iterable

from pytest_mock import MockerFixture

from tests.types import Runtime
Expand Down Expand Up @@ -198,7 +200,7 @@ def test_filter_reuses_result_if_called_multiple_times(


def test_join_combines_multiple_futures_into_one(
futures: List[Future[int]],
futures: list[Future[int]],
) -> None:
joined = futures[0].join(futures[1], futures[2])
futures[0].set(0)
Expand All @@ -209,7 +211,7 @@ def test_join_combines_multiple_futures_into_one(


def test_join_preserves_timeout_kwarg(
futures: List[Future[int]],
futures: list[Future[int]],
) -> None:
joined = futures[0].join(futures[1], futures[2])
futures[0].set(0)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_logging.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
from __future__ import annotations

import logging
from typing import TYPE_CHECKING, Any, Iterator, NoReturn, Optional
from typing import TYPE_CHECKING, Any, NoReturn, Optional

import pytest

from pykka import Actor
from tests.log_handler import LogLevel, PykkaTestLogHandler

if TYPE_CHECKING:
from collections.abc import Iterator
from types import TracebackType

from pykka import ActorRef
Expand Down
4 changes: 3 additions & 1 deletion tests/test_ref.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from __future__ import annotations

from typing import TYPE_CHECKING, Any, Callable, Iterator
from typing import TYPE_CHECKING, Any, Callable

import pytest

from pykka import Actor, ActorDeadError, Timeout

if TYPE_CHECKING:
from collections.abc import Iterator

from pykka import ActorRef, Future
from tests.types import Runtime

Expand Down
4 changes: 3 additions & 1 deletion tests/test_threading_actor.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
from __future__ import annotations

import threading
from typing import TYPE_CHECKING, Iterator
from typing import TYPE_CHECKING

import pytest

from pykka import ThreadingActor

if TYPE_CHECKING:
from collections.abc import Iterator

from pykka import ActorRef


Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
isolated_build = true
envlist = py38, py39, py310, py311, py312, py313, docs, mypy, ruff-format, ruff-lint
envlist = py39, py310, py311, py312, py313, docs, mypy, ruff-format, ruff-lint

[testenv]
allowlist_externals = poetry
Expand Down