Skip to content

Commit 43e878b

Browse files
authored
[python] Validate pyproject.toml and fix the pyproject.toml version constraint format (#21402)
* Validate pyproject.toml of echo client python sample * Use PEP-508 compatible version constraint for `requires-python` key * Update samples * Move job to petstore workflow * Update generated sample * Use equals or greater than operator instead of greater than * Update samples
1 parent 50c6754 commit 43e878b

File tree

5 files changed

+16
-4
lines changed

5 files changed

+16
-4
lines changed

.github/workflows/samples-python-petstore.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@ on:
88
- .github/workflows/samples-python-petstore.yaml
99

1010
jobs:
11+
validate-pyproject-toml:
12+
name: Validate pyproject.toml
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.13"
19+
- name: Install validator
20+
run: pip install 'validate-pyproject[all]'
21+
- name: Validate
22+
run: validate-pyproject samples/openapi3/client/petstore/python/pyproject.toml
1123
build:
1224
name: Test Python client
1325
runs-on: ubuntu-latest

modules/openapi-generator/src/main/resources/python/pyproject.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pydantic = ">= 2"
4343
typing-extensions = ">= 4.7.1"
4444
{{/poetry1}}
4545
{{^poetry1}}
46-
requires-python = "^3.9"
46+
requires-python = ">=3.9"
4747

4848
dependencies = [
4949
"urllib3 (>=2.1.0,<3.0.0)",

samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ authors = [
88
license = "Apache 2.0"
99
readme = "README.md"
1010
keywords = ["OpenAPI", "OpenAPI-Generator", "Echo Server API"]
11-
requires-python = "^3.9"
11+
requires-python = ">=3.9"
1212

1313
dependencies = [
1414
"urllib3 (>=2.1.0,<3.0.0)",

samples/client/echo_api/python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ authors = [
88
license = "Apache 2.0"
99
readme = "README.md"
1010
keywords = ["OpenAPI", "OpenAPI-Generator", "Echo Server API"]
11-
requires-python = "^3.9"
11+
requires-python = ">=3.9"
1212

1313
dependencies = [
1414
"urllib3 (>=2.1.0,<3.0.0)",

samples/openapi3/client/petstore/python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ authors = [
88
license = "Apache-2.0"
99
readme = "README.md"
1010
keywords = ["OpenAPI", "OpenAPI-Generator", "OpenAPI Petstore"]
11-
requires-python = "^3.9"
11+
requires-python = ">=3.9"
1212

1313
dependencies = [
1414
"urllib3 (>=2.1.0,<3.0.0)",

0 commit comments

Comments
 (0)