Skip to content

Commit

Permalink
Remove Python 3.8 support (#1143)
Browse files Browse the repository at this point in the history
Now that 3.8 is EoL, we can finally update to use 3.9's generic syntax!

---------

Co-authored-by: Dylan Anthony <[email protected]>
  • Loading branch information
dbanty and dbanty authored Nov 23, 2024
1 parent 9fe5dc1 commit 46dcdc5
Show file tree
Hide file tree
Showing 206 changed files with 1,330 additions and 1,322 deletions.
8 changes: 8 additions & 0 deletions .changeset/drop_support_for_python_38.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
default: major
---

# Drop support for Python 3.8

Python 3.8 is no longer supported. "New" 3.9 syntax, like generics on builtin collections, is used both in the generator
and the generated code.
8 changes: 8 additions & 0 deletions .changeset/type_is_now_a_reserved_field_name.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
default: major
---

# `type` is now a reserved field name

Because `type` is used in type annotations now, it is no longer a valid field name. Fields which were previously named
`type` will be renamed to `type_`.
4 changes: 2 additions & 2 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
test:
strategy:
matrix:
python: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ]
python: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
- name: Set up Python
uses: actions/[email protected]
with:
python-version: "3.8"
python-version: "3.9"
- name: Get Python Version
id: get_python_version
run: echo "python_version=$(python --version)" >> $GITHUB_OUTPUT
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ To request a feature:
### Setting up a Dev Environment

1. Make sure you have [PDM](https://pdm-project.org) installed and up to date.
2. Make sure you have a supported Python version (e.g. 3.8) installed.
2. Make sure you have a supported Python version (e.g. 3.13) installed.
3. Use `pdm install` in the project directory to create a virtual environment with the relevant dependencies.

### Writing tests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Contains methods for accessing the API"""

from typing import Type

from .bodies import BodiesEndpoints
from .config import ConfigEndpoints
from .default import DefaultEndpoints
Expand All @@ -19,53 +17,53 @@

class MyTestApiClientApi:
@classmethod
def bodies(cls) -> Type[BodiesEndpoints]:
def bodies(cls) -> type[BodiesEndpoints]:
return BodiesEndpoints

@classmethod
def tests(cls) -> Type[TestsEndpoints]:
def tests(cls) -> type[TestsEndpoints]:
return TestsEndpoints

@classmethod
def defaults(cls) -> Type[DefaultsEndpoints]:
def defaults(cls) -> type[DefaultsEndpoints]:
return DefaultsEndpoints

@classmethod
def enums(cls) -> Type[EnumsEndpoints]:
def enums(cls) -> type[EnumsEndpoints]:
return EnumsEndpoints

@classmethod
def responses(cls) -> Type[ResponsesEndpoints]:
def responses(cls) -> type[ResponsesEndpoints]:
return ResponsesEndpoints

@classmethod
def default(cls) -> Type[DefaultEndpoints]:
def default(cls) -> type[DefaultEndpoints]:
return DefaultEndpoints

@classmethod
def parameters(cls) -> Type[ParametersEndpoints]:
def parameters(cls) -> type[ParametersEndpoints]:
return ParametersEndpoints

@classmethod
def tag1(cls) -> Type[Tag1Endpoints]:
def tag1(cls) -> type[Tag1Endpoints]:
return Tag1Endpoints

@classmethod
def location(cls) -> Type[LocationEndpoints]:
def location(cls) -> type[LocationEndpoints]:
return LocationEndpoints

@classmethod
def true_(cls) -> Type[True_Endpoints]:
def true_(cls) -> type[True_Endpoints]:
return True_Endpoints

@classmethod
def naming(cls) -> Type[NamingEndpoints]:
def naming(cls) -> type[NamingEndpoints]:
return NamingEndpoints

@classmethod
def parameter_references(cls) -> Type[ParameterReferencesEndpoints]:
def parameter_references(cls) -> type[ParameterReferencesEndpoints]:
return ParameterReferencesEndpoints

@classmethod
def config(cls) -> Type[ConfigEndpoints]:
def config(cls) -> type[ConfigEndpoints]:
return ConfigEndpoints
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
from typing import Any, Optional, Union

import httpx

Expand All @@ -12,10 +12,10 @@
def _get_kwargs(
*,
body: JsonLikeBody,
) -> Dict[str, Any]:
headers: Dict[str, Any] = {}
) -> dict[str, Any]:
headers: dict[str, Any] = {}

_kwargs: Dict[str, Any] = {
_kwargs: dict[str, Any] = {
"method": "post",
"url": "/bodies/json-like",
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
from typing import Any, Optional, Union

import httpx

Expand All @@ -19,10 +19,10 @@ def _get_kwargs(
PostBodiesMultipleDataBody,
PostBodiesMultipleFilesBody,
],
) -> Dict[str, Any]:
headers: Dict[str, Any] = {}
) -> dict[str, Any]:
headers: dict[str, Any] = {}

_kwargs: Dict[str, Any] = {
_kwargs: dict[str, Any] = {
"method": "post",
"url": "/bodies/multiple",
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
from typing import Any, Optional, Union

import httpx

Expand All @@ -12,10 +12,10 @@
def _get_kwargs(
*,
body: AModel,
) -> Dict[str, Any]:
headers: Dict[str, Any] = {}
) -> dict[str, Any]:
headers: dict[str, Any] = {}

_kwargs: Dict[str, Any] = {
_kwargs: dict[str, Any] = {
"method": "post",
"url": "/bodies/refs",
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union, cast
from typing import Any, Optional, Union, cast

import httpx

Expand All @@ -11,10 +11,10 @@
def _get_kwargs(
*,
body: str,
) -> Dict[str, Any]:
headers: Dict[str, Any] = {}
) -> dict[str, Any]:
headers: dict[str, Any] = {}

_kwargs: Dict[str, Any] = {
_kwargs: dict[str, Any] = {
"method": "post",
"url": "/config/content-type-override",
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
from typing import Any, Optional, Union

import httpx

Expand All @@ -11,14 +11,14 @@
def _get_kwargs(
*,
common: Union[Unset, str] = UNSET,
) -> Dict[str, Any]:
params: Dict[str, Any] = {}
) -> dict[str, Any]:
params: dict[str, Any] = {}

params["common"] = common

params = {k: v for k, v in params.items() if v is not UNSET and v is not None}

_kwargs: Dict[str, Any] = {
_kwargs: dict[str, Any] = {
"method": "get",
"url": "/common_parameters",
"params": params,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
from typing import Any, Optional, Union

import httpx

Expand All @@ -9,8 +9,8 @@
from ...types import Response


def _get_kwargs() -> Dict[str, Any]:
_kwargs: Dict[str, Any] = {
def _get_kwargs() -> dict[str, Any]:
_kwargs: dict[str, Any] = {
"method": "get",
"url": "/models/allof",
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
from typing import Any, Optional, Union

import httpx

Expand All @@ -14,8 +14,8 @@
from ...types import Response


def _get_kwargs() -> Dict[str, Any]:
_kwargs: Dict[str, Any] = {
def _get_kwargs() -> dict[str, Any]:
_kwargs: dict[str, Any] = {
"method": "get",
"url": "/models/oneof-with-required-const",
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
from typing import Any, Optional, Union

import httpx

Expand All @@ -11,14 +11,14 @@
def _get_kwargs(
*,
common: Union[Unset, str] = UNSET,
) -> Dict[str, Any]:
params: Dict[str, Any] = {}
) -> dict[str, Any]:
params: dict[str, Any] = {}

params["common"] = common

params = {k: v for k, v in params.items() if v is not UNSET and v is not None}

_kwargs: Dict[str, Any] = {
_kwargs: dict[str, Any] = {
"method": "post",
"url": "/common_parameters",
"params": params,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
from typing import Any, Optional, Union

import httpx

Expand All @@ -12,16 +12,16 @@ def _get_kwargs(
*,
client_query: str,
url_query: str,
) -> Dict[str, Any]:
params: Dict[str, Any] = {}
) -> dict[str, Any]:
params: dict[str, Any] = {}

params["client"] = client_query

params["url"] = url_query

params = {k: v for k, v in params.items() if v is not UNSET and v is not None}

_kwargs: Dict[str, Any] = {
_kwargs: dict[str, Any] = {
"method": "get",
"url": "/naming/reserved-parameters",
"params": params,
Expand Down
Loading

0 comments on commit 46dcdc5

Please sign in to comment.