Skip to content

Commit 8fb1e79

Browse files
committed
Merge branch 'main' into multiple_tags
# Conflicts: # tests/test_parser/test_openapi.py
2 parents cad0989 + ee27f31 commit 8fb1e79

File tree

377 files changed

+30099
-9780
lines changed

Some content is hidden

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

377 files changed

+30099
-9780
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
default: major
3+
---
4+
5+
# Delete fewer files with `--overwrite`
6+
7+
`--overwrite` will no longer delete the entire output directory before regenerating. Instead, it will only delete
8+
specific, known directories within that directory. Right now, that is only the generated `models` and `api` directories.
9+
10+
Other generated files, like `README.md`, will be overwritten. Extra files and directories outside of those listed above
11+
will be left untouched, so you can any extra modules or files around while still updating `pyproject.toml` automatically.
12+
13+
Closes #1105.
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/ISSUE_TEMPLATE/bug_report.md

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,17 @@
11
---
2-
name: Bug report
3-
about: Create a report to help us improve
2+
name: Report a bug
3+
about: Missing OpenAPI functionality are feature requests, not bugs!
44
title: ''
55
labels: bug
66
assignees: ''
77

88
---
99

1010
**Describe the bug**
11-
A clear and concise description of what the bug is.
12-
13-
**To Reproduce**
14-
Steps to reproduce the behavior:
15-
1. Go to '...'
16-
2. Click on '....'
17-
3. Scroll down to '....'
18-
4. See error
19-
20-
**Expected behavior**
21-
A clear and concise description of what you expected to happen.
11+
A clear and concise description of what the bug is. If this used to work, when did it stop working?
2212

2313
**OpenAPI Spec File**
24-
A link to your openapi.json which produces this issue.
14+
A link to an OpenAPI document which produces this issue. Ideally, write a minimal reproduction only containing the problematic pieces.
2515

2616
**Desktop (please complete the following information):**
2717
- OS: [e.g. macOS 10.15.1]

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ blank_issues_enabled: false
22
contact_links:
33
- name: GitHub Discussions
44
url: https://github.com/openapi-generators/openapi-python-client/discussions
5-
about: Please ask and answer questions here.
5+
about: Request features and improvements here!
66
- name: Discord
77
url: https://discord.gg/JaqVvBgwYw
88
about: Less structured, more casual chat.

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/check_for_changes.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

.github/renovate.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
":semanticCommitTypeAll(chore)"
55
],
66
"rangeStrategy": "widen",
7+
"lockFileMaintenance": { "enabled": true, "automerge": true },
78
"regexManagers": [
89
{
910
"fileMatch": [
10-
"release.*\\.yml"
11+
"release.*\\.yml",
12+
"prerelease.yml"
1113
],
1214
"matchStrings": [
1315
"version:\\s*(?<currentValue>.*)"

.github/workflows/checks.yml

Lines changed: 129 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -11,116 +11,195 @@ jobs:
1111
test:
1212
strategy:
1313
matrix:
14-
python: [ "3.8", "3.9", "3.10", "3.11" ]
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:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4.2.2
1919
- name: Set up Python
20-
uses: actions/setup-python@v4
20+
uses: actions/setup-python@v5.3.0
2121
with:
2222
python-version: ${{ matrix.python }}
2323

2424
- name: Get Python Version
2525
id: get_python_version
2626
run: echo "python_version=$(python --version)" >> $GITHUB_OUTPUT
27+
shell: bash
2728

2829
- name: Cache dependencies
29-
uses: actions/cache@v3
30+
uses: actions/cache@v4
3031
with:
3132
path: .venv
32-
key: ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies-${{ hashFiles('**/poetry.lock') }}
33+
key: ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies-${{ hashFiles('**/pdm.lock') }}
3334
restore-keys: |
3435
${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies
35-
- name: Install Poetry
36-
run: pip install poetry
36+
- name: Install PDM
37+
run: pip install pdm
3738

38-
- name: Create Virtual Environment
39-
run: python -m venv .venv
39+
- name: Install Dependencies
40+
run: pdm install
4041

41-
- name: Upgrade pip
42-
run: poetry run python -m pip install --upgrade pip
42+
- name: Check formatting
43+
run: pdm run ruff format . --check
4344

44-
- name: Install Dependencies
45-
run: poetry install
45+
- name: Run mypy
46+
run: pdm mypy --show-error-codes
4647

47-
- name: Run Black
48-
run: poetry run black . --check
48+
- name: Lint
49+
run: pdm run ruff check .
4950

50-
- name: Run isort
51-
run: poetry run isort . --check
51+
- name: Run pytest without coverage
52+
if: matrix.os != 'ubuntu-latest'
53+
run: pdm test
5254

53-
- name: Run safety
54-
run: poetry export -f requirements.txt | poetry run safety check --bare --stdin
55+
- name: Run pytest with coverage
56+
if: matrix.os == 'ubuntu-latest'
57+
run: pdm test_with_coverage
5558

56-
- name: Run mypy
57-
run: poetry run mypy --show-error-codes openapi_python_client
59+
- run: mv .coverage .coverage.${{ matrix.python }}
60+
if: matrix.os == 'ubuntu-latest'
5861

59-
- name: Run pylint
60-
run: poetry run pylint openapi_python_client
62+
- name: Store coverage report
63+
uses: actions/[email protected]
64+
if: matrix.os == 'ubuntu-latest'
65+
with:
66+
name: coverage-${{ matrix.python }}
67+
path: .coverage.${{ matrix.python }}
68+
if-no-files-found: error
69+
include-hidden-files: true
6170

62-
- name: Run pytest
63-
run: poetry run pytest --cov=openapi_python_client --cov-report=term-missing tests end_to_end_tests/test_end_to_end.py --basetemp=tests/tmp
64-
env:
65-
TASKIPY: true
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"
6682

67-
- name: Generate coverage report
83+
- name: Get Python Version
84+
id: get_python_version
85+
run: echo "python_version=$(python --version)" >> $GITHUB_OUTPUT
6886
shell: bash
69-
run: poetry run coverage xml
7087

71-
- uses: codecov/codecov-action@v3
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+
110+
coverage:
111+
name: Combine & check coverage
112+
needs: test
113+
runs-on: ubuntu-latest
114+
steps:
115+
- uses: actions/[email protected]
116+
- uses: actions/setup-python@v5
72117
with:
73-
files: ./coverage.xml
118+
python-version: "3.12"
119+
- name: Download coverage reports
120+
uses: actions/[email protected]
121+
with:
122+
merge-multiple: true
123+
124+
- name: Create Virtual Environment
125+
run: python -m venv .venv
126+
127+
- name: Combine coverage & fail if it's <100%.
128+
run: |
129+
# Install coverage
130+
.venv/bin/pip install --upgrade coverage[toml]
131+
132+
# Find all of the downloaded coverage reports and combine them
133+
.venv/bin/python -m coverage combine
134+
135+
# Create html report
136+
.venv/bin/python -m coverage html --skip-covered --skip-empty
137+
138+
# Report in Markdown and write to summary.
139+
.venv/bin/python -m coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
140+
141+
# Report again and fail if under 100%.
142+
.venv/bin/python -m coverage report --fail-under=100
143+
144+
- name: Upload HTML report if check failed.
145+
uses: actions/[email protected]
146+
with:
147+
name: html-report
148+
path: htmlcov
149+
if: ${{ failure() }}
74150

75151
integration:
76152
name: Integration Tests
77153
runs-on: ubuntu-latest
154+
strategy:
155+
matrix:
156+
httpx_version:
157+
- "0.20.0"
158+
- ""
78159
services:
79160
openapi-test-server:
80161
image: ghcr.io/openapi-generators/openapi-test-server:0.0.1
81162
ports:
82163
- "3000:3000"
83164
steps:
84-
- uses: actions/checkout@v3
165+
- uses: actions/checkout@v4.2.2
85166
- name: Set up Python
86-
uses: actions/setup-python@v4
167+
uses: actions/setup-python@v5.3.0
87168
with:
88-
python-version: "3.10"
169+
python-version: "3.9"
89170
- name: Get Python Version
90171
id: get_python_version
91172
run: echo "python_version=$(python --version)" >> $GITHUB_OUTPUT
92173
- name: Cache dependencies
93-
uses: actions/cache@v3
174+
uses: actions/cache@v4
94175
with:
95176
path: .venv
96-
key: ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies-${{ hashFiles('**/poetry.lock') }}
177+
key: ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies-${{ hashFiles('**/pdm.lock') }}
97178
restore-keys: |
98179
${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies
99180
- name: Install dependencies
100181
run: |
101-
pip install poetry
182+
pip install pdm
102183
python -m venv .venv
103-
poetry run python -m pip install --upgrade pip
104-
poetry install
105-
- name: Regenerate Integration Client
106-
run: |
107-
poetry run openapi-python-client update --url http://localhost:3000/openapi.json --config integration-tests-config.yaml
108-
- name: Check for any file changes
109-
run: python .github/check_for_changes.py
184+
pdm install
110185
- name: Cache Generated Client Dependencies
111-
uses: actions/cache@v3
186+
uses: actions/cache@v4
112187
with:
113188
path: integration-tests/.venv
114-
key: ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-integration-dependencies-${{ hashFiles('**/poetry.lock') }}
189+
key: ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-integration-dependencies-${{ hashFiles('**/pdm.lock') }}
115190
restore-keys: |
116191
${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-integration-dependencies
192+
- name: Set httpx version
193+
if: matrix.httpx_version != ''
194+
run: |
195+
cd integration-tests
196+
pdm add httpx==${{ matrix.httpx_version }}
117197
- name: Install Integration Dependencies
118198
run: |
119199
cd integration-tests
120-
python -m venv .venv
121-
poetry run python -m pip install --upgrade pip
122-
poetry install
200+
pdm install
123201
- name: Run Tests
124202
run: |
125203
cd integration-tests
126-
poetry run pytest
204+
pdm run pytest
205+
pdm run mypy . --strict

.github/workflows/codeql-analysis.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)