Skip to content

Commit

Permalink
OPT: remove Python 3.8 support
Browse files Browse the repository at this point in the history
  • Loading branch information
eigenein committed Oct 8, 2024
1 parent 40d67c4 commit dc3dc1c
Show file tree
Hide file tree
Showing 30 changed files with 53 additions and 76 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ jobs:
fail-fast: false
matrix:
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- 'pypy-3.10'

services:
redis:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ clean:

.PHONY: install
install:
poetry install --all-extras --with=dev --with=docs
poetry install --sync --all-extras --with=dev --with=docs

.PHONY: lint
lint: lint/ruff lint/mypy
Expand Down
3 changes: 2 additions & 1 deletion cachetory/backends/async_/django.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from __future__ import annotations

from collections.abc import AsyncIterable, Iterable
from datetime import datetime, timedelta
from typing import AsyncIterable, Generic, Iterable
from typing import Generic
from urllib.parse import urlparse

from django.core.cache import BaseCache, cache, caches # type: ignore[import-untyped]
Expand Down
3 changes: 2 additions & 1 deletion cachetory/backends/async_/dummy.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from __future__ import annotations

from collections.abc import AsyncIterable, Iterable
from datetime import datetime, timedelta
from typing import AsyncIterable, Generic, Iterable
from typing import Generic

from cachetory.interfaces.backends.async_ import AsyncBackend
from cachetory.interfaces.backends.private import WireT
Expand Down
3 changes: 2 additions & 1 deletion cachetory/backends/async_/memory.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from __future__ import annotations

from collections.abc import Coroutine
from datetime import datetime, timedelta
from typing import Any, Coroutine, Generic
from typing import Any, Generic

from cachetory.backends.sync.memory import MemoryBackend as SyncMemoryBackend
from cachetory.interfaces.backends.async_ import AsyncBackend
Expand Down
2 changes: 1 addition & 1 deletion cachetory/backends/async_/redis.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from __future__ import annotations

import itertools
from collections.abc import AsyncIterable, Iterable
from datetime import datetime, timedelta
from types import TracebackType
from typing import AsyncIterable, Iterable

from redis.asyncio import Redis

Expand Down
3 changes: 2 additions & 1 deletion cachetory/backends/sync/django.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from __future__ import annotations

from collections.abc import Iterable
from datetime import datetime, timedelta
from typing import Generic, Iterable
from typing import Generic
from urllib.parse import urlparse

from django.core.cache import BaseCache, cache, caches # type: ignore[import-untyped]
Expand Down
3 changes: 2 additions & 1 deletion cachetory/backends/sync/dummy.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from __future__ import annotations

from collections.abc import Iterable
from datetime import datetime, timedelta
from typing import Generic, Iterable
from typing import Generic

from cachetory.interfaces.backends.private import WireT
from cachetory.interfaces.backends.sync import SyncBackend
Expand Down
2 changes: 1 addition & 1 deletion cachetory/backends/sync/redis.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from __future__ import annotations

import itertools
from collections.abc import Iterable
from datetime import datetime, timedelta
from types import TracebackType
from typing import Iterable

from redis import Redis

Expand Down
3 changes: 2 additions & 1 deletion cachetory/caches/async_.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from __future__ import annotations

from asyncio import get_running_loop
from collections.abc import Iterable, Mapping
from concurrent.futures import Executor
from contextlib import AbstractAsyncContextManager
from datetime import timedelta
from types import TracebackType
from typing import Generic, Iterable, Mapping
from typing import Generic

from cachetory.caches.private import DefaultT
from cachetory.interfaces.backends.async_ import AsyncBackend
Expand Down
9 changes: 5 additions & 4 deletions cachetory/caches/sync.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from collections.abc import Iterable, Mapping
from contextlib import AbstractContextManager
from datetime import timedelta
from types import TracebackType
from typing import Dict, Generic, Iterable, Mapping, Optional, Tuple, Type, Union
from typing import Generic, Optional, Union

from cachetory.caches.private import DefaultT
from cachetory.interfaces.backends.private import WireT
Expand Down Expand Up @@ -66,7 +67,7 @@ def get(self, key: str, default: DefaultT = None) -> Union[ValueT, DefaultT]: #
except KeyError:
return default

def get_many(self, *keys: str) -> Dict[str, ValueT]:
def get_many(self, *keys: str) -> dict[str, ValueT]:
"""
Retrieve many values from the cache.
Expand Down Expand Up @@ -118,7 +119,7 @@ def set( # noqa: A003
if_not_exists=if_not_exists,
)

def set_many(self, items: Union[Iterable[Tuple[str, ValueT]], Mapping[str, ValueT]]) -> None:
def set_many(self, items: Union[Iterable[tuple[str, ValueT]], Mapping[str, ValueT]]) -> None:
"""
Set many cache items at once.
Expand Down Expand Up @@ -154,7 +155,7 @@ def __delitem__(self, key: str) -> None:

def __exit__(
self,
exc_type: Optional[Type[BaseException]],
exc_type: Optional[type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType],
) -> None:
Expand Down
3 changes: 2 additions & 1 deletion cachetory/decorators/async_.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from __future__ import annotations

from collections.abc import Awaitable
from datetime import timedelta
from functools import wraps
from typing import Awaitable, Callable, Protocol
from typing import Callable, Protocol

from typing_extensions import ParamSpec

Expand Down
3 changes: 2 additions & 1 deletion cachetory/interfaces/backends/async_.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
from __future__ import annotations

from abc import ABCMeta, abstractmethod
from collections.abc import AsyncIterable, Iterable
from contextlib import AbstractAsyncContextManager, AbstractContextManager
from datetime import datetime, timedelta, timezone
from types import TracebackType
from typing import Any, AsyncIterable, Generic, Iterable
from typing import Any, Generic

from typing_extensions import Never, Protocol

Expand Down
3 changes: 2 additions & 1 deletion cachetory/interfaces/backends/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
from __future__ import annotations

from abc import ABCMeta, abstractmethod
from collections.abc import Iterable
from contextlib import AbstractContextManager
from datetime import datetime, timedelta
from types import TracebackType
from typing import Generic, Iterable
from typing import Generic

from typing_extensions import Protocol

Expand Down
3 changes: 2 additions & 1 deletion cachetory/private/functools.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from __future__ import annotations

from collections.abc import Awaitable
from functools import wraps
from inspect import iscoroutinefunction
from typing import Any, Awaitable, Callable, TypeVar, cast
from typing import Any, Callable, TypeVar, cast

T = TypeVar("T")

Expand Down
3 changes: 2 additions & 1 deletion cachetory/serializers/chained.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

from typing import Any, Generic, Iterable, cast
from collections.abc import Iterable
from typing import Any, Generic, cast
from urllib.parse import urlparse

from cachetory.interfaces.backends.private import WireT
Expand Down
2 changes: 1 addition & 1 deletion cachetory/serializers/compressors/zlib.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from __future__ import annotations

import zlib
from typing import Annotated
from urllib.parse import parse_qsl, urlparse

from pydantic import BaseModel, Field
from typing_extensions import Annotated

from cachetory.interfaces.serializers import Serializer

Expand Down
2 changes: 1 addition & 1 deletion cachetory/serializers/compressors/zstd.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from __future__ import annotations

from typing import Annotated
from urllib.parse import parse_qsl, urlparse

import zstd # type: ignore
from pydantic import BaseModel, Field
from typing_extensions import Annotated

from cachetory.interfaces.serializers import Serializer

Expand Down
3 changes: 1 addition & 2 deletions cachetory/serializers/pickle.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from __future__ import annotations

import pickle
from typing import Generic
from typing import Annotated, Generic
from urllib.parse import parse_qsl, urlparse

from pydantic import BaseModel, Field
from typing_extensions import Annotated

from cachetory.interfaces.serializers import Serializer, ValueT

Expand Down
37 changes: 2 additions & 35 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
requires-python = ">=3.8"
requires-python = ">=3.9"

[tool.poetry]
authors = [
Expand All @@ -20,7 +20,6 @@ classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand All @@ -37,7 +36,7 @@ build-backend = "poetry_dynamic_versioning.backend"
django = {version = "^4.0.0 || ^5.0.0", optional = true}
ormsgpack = {version = "^1.4.0", optional = true, markers = "platform_python_implementation == 'CPython'"}
pydantic = ">2.0.0.0, <3.0.0.0"
python = "^3.8.0"
python = "^3.9.0"
redis = {version = "^4.4.2 || ^5.0.0", optional = true}
typing-extensions = "^4.4.0"
zstd = {version = "^1.5.2.6", optional = true}
Expand Down Expand Up @@ -75,11 +74,11 @@ pillow = "10.4.0"

[tool.black]
line-length = 120
target_version = ["py38", "py39", "py310", "py311"]
target_version = ["py39", "py310", "py311", "py312"]

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

[tool.ruff.lint]
select = [
Expand Down
2 changes: 1 addition & 1 deletion tests/backends/async_/test_django.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import AsyncIterable
from collections.abc import AsyncIterable

import pytest

Expand Down
2 changes: 1 addition & 1 deletion tests/backends/async_/test_memory.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections.abc import AsyncIterable
from datetime import datetime, timedelta, timezone
from typing import AsyncIterable

from freezegun import freeze_time
from pytest import fixture, mark, raises
Expand Down
2 changes: 1 addition & 1 deletion tests/backends/async_/test_redis.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from asyncio import sleep
from collections.abc import AsyncIterable
from datetime import timedelta
from typing import AsyncIterable

from pytest import fixture, mark, raises

Expand Down
2 changes: 1 addition & 1 deletion tests/backends/sync/test_django.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Iterable
from collections.abc import Iterable

import pytest

Expand Down
2 changes: 1 addition & 1 deletion tests/backends/sync/test_memory.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections.abc import Iterable
from datetime import datetime, timedelta, timezone
from typing import Iterable

from freezegun import freeze_time
from pytest import fixture, raises
Expand Down
2 changes: 1 addition & 1 deletion tests/backends/sync/test_redis.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from collections.abc import Iterable
from datetime import timedelta
from time import sleep
from typing import Iterable

from pytest import fixture, raises

Expand Down
Loading

0 comments on commit dc3dc1c

Please sign in to comment.