Skip to content

Commit ba0dfa6

Browse files
authored
Merge branch 'main' into avoid-duplicating-enum-property-names-1167
2 parents c0fbb44 + 233ac66 commit ba0dfa6

File tree

212 files changed

+2551
-1578
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

212 files changed

+2551
-1578
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
default: patch
3+
---
4+
5+
# Fix compatibility with Pydantic 2.10+
6+
7+
#1176 by @Viicos
8+
9+
Set `defer_build` to models that we know will fail to build, and call `model_rebuild`
10+
in the `__init__.py` file.

.github/workflows/checks.yml

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
test:
1212
strategy:
1313
matrix:
14-
python: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ]
14+
python: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
1515
os: [ ubuntu-latest, macos-latest, windows-latest ]
1616
runs-on: ${{ matrix.os }}
1717
steps:
@@ -51,27 +51,62 @@ jobs:
5151
- name: Run pytest without coverage
5252
if: matrix.os != 'ubuntu-latest'
5353
run: pdm test
54-
env:
55-
TASKIPY: true
5654

5755
- name: Run pytest with coverage
5856
if: matrix.os == 'ubuntu-latest'
5957
run: pdm test_with_coverage
60-
env:
61-
TASKIPY: true
62-
58+
6359
- run: mv .coverage .coverage.${{ matrix.python }}
6460
if: matrix.os == 'ubuntu-latest'
6561

6662
- name: Store coverage report
67-
uses: actions/upload-artifact@v4.4.3
63+
uses: actions/upload-artifact@v4.5.0
6864
if: matrix.os == 'ubuntu-latest'
6965
with:
7066
name: coverage-${{ matrix.python }}
7167
path: .coverage.${{ matrix.python }}
7268
if-no-files-found: error
7369
include-hidden-files: true
7470

71+
test_min_deps:
72+
strategy:
73+
matrix:
74+
os: [ ubuntu-latest, macos-latest, windows-latest ]
75+
runs-on: ${{ matrix.os }}
76+
steps:
77+
- uses: actions/[email protected]
78+
- name: Set up Python
79+
uses: actions/[email protected]
80+
with:
81+
python-version: "3.9"
82+
83+
- name: Get Python Version
84+
id: get_python_version
85+
run: echo "python_version=$(python --version)" >> $GITHUB_OUTPUT
86+
shell: bash
87+
88+
- name: Cache dependencies
89+
uses: actions/cache@v4
90+
with:
91+
path: .venv
92+
key: ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-min-dependencies-${{ hashFiles('**/pdm.lock') }}
93+
restore-keys: |
94+
${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-min-dependencies
95+
- name: Install PDM
96+
run: pip install pdm
97+
98+
- name: Install minimum dependencies
99+
run: pdm install -L pdm.minimal.lock
100+
101+
- name: Run mypy
102+
run: pdm mypy --show-error-codes
103+
104+
- name: Lint
105+
run: pdm run ruff check .
106+
107+
- name: Run unit tests only # snapshots are expected to fail
108+
run: pdm unit_test
109+
75110
coverage:
76111
name: Combine & check coverage
77112
needs: test
@@ -107,7 +142,7 @@ jobs:
107142
.venv/bin/python -m coverage report --fail-under=100
108143
109144
- name: Upload HTML report if check failed.
110-
uses: actions/upload-artifact@v4.4.3
145+
uses: actions/upload-artifact@v4.5.0
111146
with:
112147
name: html-report
113148
path: htmlcov
@@ -131,7 +166,7 @@ jobs:
131166
- name: Set up Python
132167
uses: actions/[email protected]
133168
with:
134-
python-version: "3.8"
169+
python-version: "3.9"
135170
- name: Get Python Version
136171
id: get_python_version
137172
run: echo "python_version=$(python --version)" >> $GITHUB_OUTPUT

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ jobs:
1818
- name: Build
1919
run: hatchling build
2020
- name: Push to PyPI
21-
uses: pypa/gh-action-pypi-publish@v1.10.3
21+
uses: pypa/gh-action-pypi-publish@v1.12.3
2222
with:
2323
attestations: true

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,31 @@ Programmatic usage of this project (e.g., importing it as a Python module) and t
1313

1414
The 0.x prefix used in versions for this project is to indicate that breaking changes are expected frequently (several times a year). Breaking changes will increment the minor number, all other changes will increment the patch number. You can track the progress toward 1.0 [here](https://github.com/openapi-generators/openapi-python-client/projects/2).
1515

16+
## 0.22.0 (2024-11-23)
17+
18+
### Breaking Changes
19+
20+
#### Drop support for Python 3.8
21+
22+
Python 3.8 is no longer supported. "New" 3.9 syntax, like generics on builtin collections, is used both in the generator
23+
and the generated code.
24+
25+
#### `type` is now a reserved field name
26+
27+
Because `type` is used in type annotations now, it is no longer a valid field name. Fields which were previously named
28+
`type` will be renamed to `type_`.
29+
30+
### Features
31+
32+
- Support Ruff 0.8 (#1169)
33+
34+
## 0.21.7 (2024-10-28)
35+
36+
### Fixes
37+
38+
- allow required fields list to be specified as empty (#651) (#1149)
39+
- import cast for required const properties, since it's used in the template (#1153)
40+
1641
## 0.21.6 (2024-10-20)
1742

1843
### Features

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ To request a feature:
4141
### Setting up a Dev Environment
4242

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

4747
### Writing tests
Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""Contains methods for accessing the API"""
22

3-
from typing import Type
4-
53
from .bodies import BodiesEndpoints
64
from .config import ConfigEndpoints
75
from .default import DefaultEndpoints
@@ -19,53 +17,53 @@
1917

2018
class MyTestApiClientApi:
2119
@classmethod
22-
def bodies(cls) -> Type[BodiesEndpoints]:
20+
def bodies(cls) -> type[BodiesEndpoints]:
2321
return BodiesEndpoints
2422

2523
@classmethod
26-
def tests(cls) -> Type[TestsEndpoints]:
24+
def tests(cls) -> type[TestsEndpoints]:
2725
return TestsEndpoints
2826

2927
@classmethod
30-
def defaults(cls) -> Type[DefaultsEndpoints]:
28+
def defaults(cls) -> type[DefaultsEndpoints]:
3129
return DefaultsEndpoints
3230

3331
@classmethod
34-
def enums(cls) -> Type[EnumsEndpoints]:
32+
def enums(cls) -> type[EnumsEndpoints]:
3533
return EnumsEndpoints
3634

3735
@classmethod
38-
def responses(cls) -> Type[ResponsesEndpoints]:
36+
def responses(cls) -> type[ResponsesEndpoints]:
3937
return ResponsesEndpoints
4038

4139
@classmethod
42-
def default(cls) -> Type[DefaultEndpoints]:
40+
def default(cls) -> type[DefaultEndpoints]:
4341
return DefaultEndpoints
4442

4543
@classmethod
46-
def parameters(cls) -> Type[ParametersEndpoints]:
44+
def parameters(cls) -> type[ParametersEndpoints]:
4745
return ParametersEndpoints
4846

4947
@classmethod
50-
def tag1(cls) -> Type[Tag1Endpoints]:
48+
def tag1(cls) -> type[Tag1Endpoints]:
5149
return Tag1Endpoints
5250

5351
@classmethod
54-
def location(cls) -> Type[LocationEndpoints]:
52+
def location(cls) -> type[LocationEndpoints]:
5553
return LocationEndpoints
5654

5755
@classmethod
58-
def true_(cls) -> Type[True_Endpoints]:
56+
def true_(cls) -> type[True_Endpoints]:
5957
return True_Endpoints
6058

6159
@classmethod
62-
def naming(cls) -> Type[NamingEndpoints]:
60+
def naming(cls) -> type[NamingEndpoints]:
6361
return NamingEndpoints
6462

6563
@classmethod
66-
def parameter_references(cls) -> Type[ParameterReferencesEndpoints]:
64+
def parameter_references(cls) -> type[ParameterReferencesEndpoints]:
6765
return ParameterReferencesEndpoints
6866

6967
@classmethod
70-
def config(cls) -> Type[ConfigEndpoints]:
68+
def config(cls) -> type[ConfigEndpoints]:
7169
return ConfigEndpoints

end_to_end_tests/golden-record/my_test_api_client/api/bodies/json_like.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from http import HTTPStatus
2-
from typing import Any, Dict, Optional, Union
2+
from typing import Any, Optional, Union
33

44
import httpx
55

@@ -12,10 +12,10 @@
1212
def _get_kwargs(
1313
*,
1414
body: JsonLikeBody,
15-
) -> Dict[str, Any]:
16-
headers: Dict[str, Any] = {}
15+
) -> dict[str, Any]:
16+
headers: dict[str, Any] = {}
1717

18-
_kwargs: Dict[str, Any] = {
18+
_kwargs: dict[str, Any] = {
1919
"method": "post",
2020
"url": "/bodies/json-like",
2121
}

end_to_end_tests/golden-record/my_test_api_client/api/bodies/post_bodies_multiple.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from http import HTTPStatus
2-
from typing import Any, Dict, Optional, Union
2+
from typing import Any, Optional, Union
33

44
import httpx
55

@@ -19,10 +19,10 @@ def _get_kwargs(
1919
PostBodiesMultipleDataBody,
2020
PostBodiesMultipleFilesBody,
2121
],
22-
) -> Dict[str, Any]:
23-
headers: Dict[str, Any] = {}
22+
) -> dict[str, Any]:
23+
headers: dict[str, Any] = {}
2424

25-
_kwargs: Dict[str, Any] = {
25+
_kwargs: dict[str, Any] = {
2626
"method": "post",
2727
"url": "/bodies/multiple",
2828
}

end_to_end_tests/golden-record/my_test_api_client/api/bodies/refs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from http import HTTPStatus
2-
from typing import Any, Dict, Optional, Union
2+
from typing import Any, Optional, Union
33

44
import httpx
55

@@ -12,10 +12,10 @@
1212
def _get_kwargs(
1313
*,
1414
body: AModel,
15-
) -> Dict[str, Any]:
16-
headers: Dict[str, Any] = {}
15+
) -> dict[str, Any]:
16+
headers: dict[str, Any] = {}
1717

18-
_kwargs: Dict[str, Any] = {
18+
_kwargs: dict[str, Any] = {
1919
"method": "post",
2020
"url": "/bodies/refs",
2121
}

end_to_end_tests/golden-record/my_test_api_client/api/config/content_type_override.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from http import HTTPStatus
2-
from typing import Any, Dict, Optional, Union, cast
2+
from typing import Any, Optional, Union, cast
33

44
import httpx
55

@@ -11,10 +11,10 @@
1111
def _get_kwargs(
1212
*,
1313
body: str,
14-
) -> Dict[str, Any]:
15-
headers: Dict[str, Any] = {}
14+
) -> dict[str, Any]:
15+
headers: dict[str, Any] = {}
1616

17-
_kwargs: Dict[str, Any] = {
17+
_kwargs: dict[str, Any] = {
1818
"method": "post",
1919
"url": "/config/content-type-override",
2020
}

end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from http import HTTPStatus
2-
from typing import Any, Dict, Optional, Union
2+
from typing import Any, Optional, Union
33

44
import httpx
55

@@ -11,14 +11,14 @@
1111
def _get_kwargs(
1212
*,
1313
common: Union[Unset, str] = UNSET,
14-
) -> Dict[str, Any]:
15-
params: Dict[str, Any] = {}
14+
) -> dict[str, Any]:
15+
params: dict[str, Any] = {}
1616

1717
params["common"] = common
1818

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

21-
_kwargs: Dict[str, Any] = {
21+
_kwargs: dict[str, Any] = {
2222
"method": "get",
2323
"url": "/common_parameters",
2424
"params": params,

end_to_end_tests/golden-record/my_test_api_client/api/default/get_models_allof.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from http import HTTPStatus
2-
from typing import Any, Dict, Optional, Union
2+
from typing import Any, Optional, Union
33

44
import httpx
55

@@ -9,8 +9,8 @@
99
from ...types import Response
1010

1111

12-
def _get_kwargs() -> Dict[str, Any]:
13-
_kwargs: Dict[str, Any] = {
12+
def _get_kwargs() -> dict[str, Any]:
13+
_kwargs: dict[str, Any] = {
1414
"method": "get",
1515
"url": "/models/allof",
1616
}

end_to_end_tests/golden-record/my_test_api_client/api/default/get_models_oneof_with_required_const.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from http import HTTPStatus
2-
from typing import Any, Dict, Optional, Union
2+
from typing import Any, Optional, Union
33

44
import httpx
55

@@ -14,8 +14,8 @@
1414
from ...types import Response
1515

1616

17-
def _get_kwargs() -> Dict[str, Any]:
18-
_kwargs: Dict[str, Any] = {
17+
def _get_kwargs() -> dict[str, Any]:
18+
_kwargs: dict[str, Any] = {
1919
"method": "get",
2020
"url": "/models/oneof-with-required-const",
2121
}

0 commit comments

Comments
 (0)