Skip to content

Commit

Permalink
Drop Python 3.7 support (#889)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamsorcerer committed Jun 9, 2023
1 parent 79b631b commit 856de2b
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11']

steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ repos:
rev: 'v3.1.0'
hooks:
- id: pyupgrade
args: ['--py36-plus']
args: ['--py38-plus']
- repo: https://github.com/PyCQA/flake8
rev: '5.0.4'
hooks:
Expand Down
13 changes: 3 additions & 10 deletions aiohttp_session/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import abc
import json
import sys
import time
from typing import (
Any,
Expand All @@ -14,20 +13,16 @@
Iterator,
MutableMapping,
Optional,
TypedDict,
Union,
cast,
)

from aiohttp import web
from aiohttp.typedefs import Handler

Handler = Callable[[web.Request], Awaitable[web.StreamResponse]]
Middleware = Callable[[web.Request, Handler], Awaitable[web.StreamResponse]]

if sys.version_info >= (3, 8):
from typing import TypedDict
else:
from typing_extensions import TypedDict


class _CookieParams(TypedDict, total=False):
domain: Optional[str]
Expand Down Expand Up @@ -283,9 +278,7 @@ async def save_session(
pass

def load_cookie(self, request: web.Request) -> Optional[str]:
# TODO: Remove explicit type anotation when aiohttp 3.8 is out
cookie: Optional[str] = request.cookies.get(self._cookie_name)
return cookie
return request.cookies.get(self._cookie_name)

def save_cookie(
self,
Expand Down
18 changes: 14 additions & 4 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
[pytest]
addopts =
# show 10 slowest invocations:
--durations=10
# a bit of verbosity doesn't hurt:
-v
# report all the things == -rxXs:
-ra
# show values of the local vars in errors:
--showlocals
# coverage reports
--cov=aiohttp_session/ --cov=tests/ --cov-report term
asyncio_mode = auto
filterwarnings=
filterwarnings =
error
# This is internal to the docker library.
ignore:the imp module is deprecated:DeprecationWarning
ignore::DeprecationWarning
testpaths = tests/
xfail_strict = true
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def read(f):
return open(os.path.join(os.path.dirname(__file__), f)).read().strip()


install_requires = ["aiohttp>=3.8", 'typing_extensions>=3.7.4; python_version<"3.8"']
install_requires = ["aiohttp>=3.8"]
extras_require = {
"aioredis": ["redis>=4.3.1"],
"aiomcache": ["aiomcache>=0.5.2"],
Expand All @@ -40,7 +40,6 @@ def read(f):
"Intended Audience :: Developers",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand All @@ -53,7 +52,6 @@ def read(f):
url="https://github.com/aio-libs/aiohttp_session/",
license="Apache 2",
packages=["aiohttp_session"],
python_requires=">=3.7",
install_requires=install_requires,
include_package_data=True,
extras_require=extras_require,
Expand Down
7 changes: 1 addition & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,13 @@
import sys
import time
import uuid
from typing import Iterator
from typing import Iterator, TypedDict

import aiomcache
import pytest
from docker import DockerClient, from_env as docker_from_env, models as docker_models
from redis import asyncio as aioredis

if sys.version_info >= (3, 8):
from typing import TypedDict
else:
from typing_extensions import TypedDict


class _ContainerInfo(TypedDict):
host: str
Expand Down
8 changes: 2 additions & 6 deletions tests/test_abstract_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@

from aiohttp import web
from aiohttp.test_utils import TestClient
from aiohttp.typedefs import Handler

from aiohttp_session import (
Handler,
SimpleCookieStorage,
get_session,
setup as setup_middleware,
)
from aiohttp_session import SimpleCookieStorage, get_session, setup as setup_middleware

from .typedefs import AiohttpClient

Expand Down
2 changes: 1 addition & 1 deletion tests/test_cookie_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

from aiohttp import web
from aiohttp.test_utils import TestClient
from aiohttp.typedefs import Handler

from aiohttp_session import (
Handler,
Session,
SimpleCookieStorage,
get_session,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_encrypted_cookie_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
import pytest
from aiohttp import web
from aiohttp.test_utils import TestClient
from aiohttp.typedefs import Handler
from cryptography.fernet import Fernet

from aiohttp_session import (
Handler,
Session,
get_session,
new_session,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_http_exception.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from typing import Tuple

from aiohttp import web
from aiohttp.typedefs import Handler

from aiohttp_session import (
Handler,
SimpleCookieStorage,
get_session,
session_middleware,
Expand Down
3 changes: 2 additions & 1 deletion tests/test_memcached_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
import aiomcache
from aiohttp import web
from aiohttp.test_utils import TestClient
from aiohttp.typedefs import Handler

from aiohttp_session import Handler, Session, get_session, session_middleware
from aiohttp_session import Session, get_session, session_middleware
from aiohttp_session.memcached_storage import MemcachedStorage

from .typedefs import AiohttpClient
Expand Down
2 changes: 1 addition & 1 deletion tests/test_nacl_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import pytest
from aiohttp import web
from aiohttp.test_utils import TestClient
from aiohttp.typedefs import Handler
from nacl.encoding import Base64Encoder

from aiohttp_session import (
Handler,
Session,
get_session,
new_session,
Expand Down
8 changes: 2 additions & 6 deletions tests/test_path_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,9 @@

from aiohttp import web
from aiohttp.test_utils import TestClient
from aiohttp.typedefs import Handler

from aiohttp_session import (
Handler,
SimpleCookieStorage,
get_session,
session_middleware,
)
from aiohttp_session import SimpleCookieStorage, get_session, session_middleware

from .typedefs import AiohttpClient

Expand Down
3 changes: 2 additions & 1 deletion tests/test_redis_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
import pytest
from aiohttp import web
from aiohttp.test_utils import TestClient
from aiohttp.typedefs import Handler
from pytest_mock import MockFixture
from redis import asyncio as aioredis

from aiohttp_session import Handler, Session, get_session, session_middleware
from aiohttp_session import Session, get_session, session_middleware
from aiohttp_session.redis_storage import RedisStorage

from .typedefs import AiohttpClient
Expand Down
2 changes: 1 addition & 1 deletion tests/test_response_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import pytest
from aiohttp import web
from aiohttp.test_utils import make_mocked_request
from aiohttp.typedefs import Handler

from aiohttp_session import (
SESSION_KEY,
Handler,
SimpleCookieStorage,
get_session,
session_middleware,
Expand Down

0 comments on commit 856de2b

Please sign in to comment.