Skip to content

Commit

Permalink
feat: drop support for Python 3.8
Browse files Browse the repository at this point in the history
Python 3.8 has reached EOL a couple of months ago, it's time to drop support for it.
  • Loading branch information
bellini666 committed Dec 18, 2024
1 parent 633c9bc commit 2833227
Show file tree
Hide file tree
Showing 305 changed files with 3,175 additions and 2,193 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
rev: v0.8.3
hooks:
- id: ruff-format
exclude: ^tests/\w+/snapshots/
Expand Down
8 changes: 8 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Release type: minor

This release drops support for Python 3.8, which has reached EOL on
October 2024. The minimum supported Python version is now 3.9.

It's recommended to upgrade to Python 3.9 or preferably a newer version, as
older versions are no longer supported by the Python Software Foundation itself
and thus may contain security vulnerabilities.
6 changes: 3 additions & 3 deletions federation-compatibility/schema.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, List, Optional
from typing import Any, Optional

import strawberry
from strawberry.schema_directive import Location
Expand Down Expand Up @@ -252,7 +252,7 @@ def created_by(self) -> Optional[User]:
return User(**user)

notes: Optional[str] = strawberry.federation.field(tags=["internal"])
research: List[ProductResearch]
research: list[ProductResearch]

@classmethod
def from_data(cls, data: dict) -> "Product":
Expand Down Expand Up @@ -290,7 +290,7 @@ def resolve_reference(cls, **data: Any) -> Optional["Product"]:
@strawberry.federation.interface_object(keys=["id"])
class Inventory:
id: strawberry.ID
deprecated_products: List[DeprecatedProduct]
deprecated_products: list[DeprecatedProduct]

@classmethod
def resolve_reference(cls, id: strawberry.ID) -> "Inventory":
Expand Down
6 changes: 3 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import itertools
from typing import Any, Callable, List
from typing import Any, Callable

import nox
from nox_poetry import Session, session
Expand All @@ -8,7 +8,7 @@
nox.options.error_on_external_run = True
nox.options.default_venv_backend = "uv"

PYTHON_VERSIONS = ["3.13", "3.12", "3.11", "3.10", "3.9", "3.8"]
PYTHON_VERSIONS = ["3.13", "3.12", "3.11", "3.10", "3.9"]

GQL_CORE_VERSIONS = [
"3.2.3",
Expand Down Expand Up @@ -54,7 +54,7 @@ def _install_gql_core(session: Session, version: str) -> None:
)


def with_gql_core_parametrize(name: str, params: List[str]) -> Callable[[Any], Any]:
def with_gql_core_parametrize(name: str, params: list[str]) -> Callable[[Any], Any]:
# github cache doesn't support comma in the name, this is a workaround.
arg_names = f"{name}, gql_core"
combinations = list(itertools.product(params, GQL_CORE_VERSIONS))
Expand Down
86 changes: 2 additions & 84 deletions poetry.lock

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

9 changes: 3 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ requires = ["poetry-core>=1.6"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.dependencies]
python = "^3.8"
python = "^3.9"
graphql-core = ">=3.2.0,<3.4.0"
typing-extensions = ">=4.5.0"
python-dateutil = "^2.7.0"
Expand Down Expand Up @@ -191,12 +191,12 @@ append-github-contributor = true
exclude = ["**/__pycache__",]
reportMissingImports = true
reportMissingTypeStubs = false
pythonVersion = "3.8"
pythonVersion = "3.9"
stubPath = ""

[tool.ruff]
line-length = 88
target-version = "py38"
target-version = "py39"
fix = true
exclude = [
".bzr",
Expand Down Expand Up @@ -236,9 +236,7 @@ ignore = [
"S102",
"S104",
"S324",
"ANN101", # missing annotation for self?
# definitely enable these, maybe not in tests
"ANN102",
"ANN401",
"PGH003",
"PGH004",
Expand Down Expand Up @@ -283,7 +281,6 @@ ignore = [

# enable these, we have some in tests
"B006",
"PT004",
"PT007",
"PT011",
"PT012",
Expand Down
18 changes: 9 additions & 9 deletions strawberry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,39 +18,39 @@
from .types.info import Info
from .types.lazy_type import LazyType, lazy
from .types.mutation import mutation, subscription
from .types.object_type import asdict, input, interface, type
from .types.object_type import asdict, input, interface, type # noqa: A004
from .types.private import Private
from .types.scalar import scalar
from .types.union import union
from .types.unset import UNSET

__all__ = [
"BasePermission",
"experimental",
"ID",
"Info",
"UNSET",
"lazy",
"BasePermission",
"Info",
"LazyType",
"Parent",
"Private",
"Schema",
"argument",
"asdict",
"auto",
"directive",
"directive_field",
"schema_directive",
"enum",
"enum_value",
"experimental",
"federation",
"field",
"input",
"interface",
"lazy",
"mutation",
"relay",
"scalar",
"schema_directive",
"subscription",
"type",
"union",
"auto",
"asdict",
"relay",
]
18 changes: 10 additions & 8 deletions strawberry/aiohttp/test/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,25 @@

import warnings
from typing import (
TYPE_CHECKING,
Any,
Dict,
Mapping,
Optional,
)

from strawberry.test.client import BaseGraphQLTestClient, Response

if TYPE_CHECKING:
from collections.abc import Mapping


class GraphQLTestClient(BaseGraphQLTestClient):
async def query(
self,
query: str,
variables: Optional[Dict[str, Mapping]] = None,
headers: Optional[Dict[str, object]] = None,
variables: Optional[dict[str, Mapping]] = None,
headers: Optional[dict[str, object]] = None,
asserts_errors: Optional[bool] = None,
files: Optional[Dict[str, object]] = None,
files: Optional[dict[str, object]] = None,
assert_no_errors: Optional[bool] = True,
) -> Response:
body = self._build_body(query, variables, files)
Expand Down Expand Up @@ -51,9 +53,9 @@ async def query(

async def request(
self,
body: Dict[str, object],
headers: Optional[Dict[str, object]] = None,
files: Optional[Dict[str, object]] = None,
body: dict[str, object],
headers: Optional[dict[str, object]] = None,
files: Optional[dict[str, object]] = None,
) -> Any:
response = await self._client.post(
self.url,
Expand Down
12 changes: 5 additions & 7 deletions strawberry/aiohttp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
from typing import (
TYPE_CHECKING,
Any,
AsyncGenerator,
Callable,
Dict,
Iterable,
Mapping,
Optional,
Union,
cast,
Expand Down Expand Up @@ -40,6 +36,8 @@
from strawberry.subscriptions import GRAPHQL_TRANSPORT_WS_PROTOCOL, GRAPHQL_WS_PROTOCOL

if TYPE_CHECKING:
from collections.abc import AsyncGenerator, Iterable, Mapping

from strawberry.http import GraphQLHTTPResponse
from strawberry.http.ides import GraphQL_IDE
from strawberry.schema import BaseSchema
Expand Down Expand Up @@ -67,8 +65,8 @@ def headers(self) -> Mapping[str, str]:
async def get_form_data(self) -> FormData:
reader = await self.request.multipart()

data: Dict[str, Any] = {}
files: Dict[str, Any] = {}
data: dict[str, Any] = {}
files: dict[str, Any] = {}

async for field in reader:
assert isinstance(field, BodyPartReader)
Expand Down Expand Up @@ -224,7 +222,7 @@ async def create_streaming_response(
request: web.Request,
stream: Callable[[], AsyncGenerator[str, None]],
sub_response: web.Response,
headers: Dict[str, str],
headers: dict[str, str],
) -> web.StreamResponse:
response = web.StreamResponse(
status=sub_response.status,
Expand Down
Loading

0 comments on commit 2833227

Please sign in to comment.