mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2026-04-26 21:04:11 +00:00
[python] Fix poetry deprecation warnings (#21268)
* Convert pyproject.toml template to the format expected by Poetry >=2.0 (https://python-poetry.org/blog/announcing-poetry-2.0.0) * Update samples * Add option to fallback to Poetry 1.x style pyproject.toml * Generate new docs and samples * Place project.urls section a bit further down, so that it doesn't clash with other sections * Update samples
This commit is contained in:
@@ -29,6 +29,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|packageName|python package name (convention: snake_case).| |openapi_client|
|
||||
|packageUrl|python package URL.| |null|
|
||||
|packageVersion|python package version.| |1.0.0|
|
||||
|poetry1|Fallback to formatting pyproject.toml to Poetry 1.x format.| |null|
|
||||
|projectName|python project name in setup.py (e.g. petstore-api).| |null|
|
||||
|recursionLimit|Set the recursion limit. If not set, use the system default value.| |null|
|
||||
|setEnsureAsciiToFalse|When set to true, add `ensure_ascii=False` in json.dumps when creating the HTTP request body.| |false|
|
||||
|
||||
+2
@@ -47,6 +47,7 @@ public class PythonClientCodegen extends AbstractPythonCodegen implements Codege
|
||||
public static final String DATETIME_FORMAT = "datetimeFormat";
|
||||
public static final String DATE_FORMAT = "dateFormat";
|
||||
public static final String SET_ENSURE_ASCII_TO_FALSE = "setEnsureAsciiToFalse";
|
||||
public static final String POETRY1_FALLBACK = "poetry1";
|
||||
|
||||
@Setter protected String packageUrl;
|
||||
protected String apiDocPath = "docs/";
|
||||
@@ -149,6 +150,7 @@ public class PythonClientCodegen extends AbstractPythonCodegen implements Codege
|
||||
cliOptions.add(new CliOption(DATE_FORMAT, "date format for query parameters")
|
||||
.defaultValue("%Y-%m-%d"));
|
||||
cliOptions.add(new CliOption(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP_DESC).defaultValue("false"));
|
||||
cliOptions.add(new CliOption(POETRY1_FALLBACK, "Fallback to formatting pyproject.toml to Poetry 1.x format."));
|
||||
|
||||
supportedLibraries.put("urllib3", "urllib3-based client");
|
||||
supportedLibraries.put("asyncio", "asyncio-based client");
|
||||
|
||||
@@ -1,17 +1,31 @@
|
||||
{{#poetry1}}
|
||||
[tool.poetry]
|
||||
{{/poetry1}}
|
||||
{{^poetry1}}
|
||||
[project]
|
||||
{{/poetry1}}
|
||||
name = "{{{packageName}}}"
|
||||
version = "{{{packageVersion}}}"
|
||||
description = "{{{appName}}}"
|
||||
{{#poetry1}}
|
||||
authors = ["{{infoName}}{{^infoName}}OpenAPI Generator Community{{/infoName}} <{{infoEmail}}{{^infoEmail}}team@openapitools.org{{/infoEmail}}>"]
|
||||
{{/poetry1}}
|
||||
{{^poetry1}}
|
||||
authors = [
|
||||
{name = "{{infoName}}{{^infoName}}OpenAPI Generator Community{{/infoName}}",email = "{{infoEmail}}{{^infoEmail}}team@openapitools.org{{/infoEmail}}"},
|
||||
]
|
||||
{{/poetry1}}
|
||||
license = "{{{licenseInfo}}}{{^licenseInfo}}NoLicense{{/licenseInfo}}"
|
||||
readme = "README.md"
|
||||
{{#poetry1}}
|
||||
repository = "https://{{{gitHost}}}/{{{gitUserId}}}/{{{gitRepoId}}}"
|
||||
{{/poetry1}}
|
||||
keywords = ["OpenAPI", "OpenAPI-Generator", "{{{appName}}}"]
|
||||
{{#poetry1}}
|
||||
include = ["{{packageName}}/py.typed"]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.9"
|
||||
|
||||
urllib3 = ">= 2.1.0, < 3.0.0"
|
||||
python-dateutil = ">= 2.8.2"
|
||||
{{#asyncio}}
|
||||
@@ -27,8 +41,43 @@ pycryptodome = ">= 3.9.0"
|
||||
{{/hasHttpSignatureMethods}}
|
||||
pydantic = ">= 2"
|
||||
typing-extensions = ">= 4.7.1"
|
||||
{{/poetry1}}
|
||||
{{^poetry1}}
|
||||
requires-python = "^3.9"
|
||||
|
||||
dependencies = [
|
||||
"urllib3 (>=2.1.0,<3.0.0)",
|
||||
"python-dateutil (>=2.8.2)",
|
||||
{{#asyncio}}
|
||||
"aiohttp (>=3.8.4)",
|
||||
"aiohttp-retry (>=2.8.3)",
|
||||
{{/asyncio}}
|
||||
{{#tornado}}
|
||||
"tornado (>=4.2,<5)",
|
||||
{{/tornado}}
|
||||
{{#hasHttpSignatureMethods}}
|
||||
"pem (>=19.3.0)",
|
||||
"pycryptodome (>=3.9.0)",
|
||||
{{/hasHttpSignatureMethods}}
|
||||
"pydantic (>=2)",
|
||||
"typing-extensions (>=4.7.1)"
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
Repository = "https://{{{gitHost}}}/{{{gitUserId}}}/{{{gitRepoId}}}"
|
||||
|
||||
{{/poetry1}}
|
||||
{{^poetry1}}
|
||||
[tool.poetry]
|
||||
requires-poetry = ">=2.0"
|
||||
{{/poetry1}}
|
||||
|
||||
{{#poetry1}}
|
||||
[tool.poetry.dev-dependencies]
|
||||
{{/poetry1}}
|
||||
{{^poetry1}}
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
{{/poetry1}}
|
||||
pytest = ">= 7.2.1"
|
||||
pytest-cov = ">= 2.8.1"
|
||||
tox = ">= 3.9.0"
|
||||
|
||||
+17
-11
@@ -1,23 +1,29 @@
|
||||
[tool.poetry]
|
||||
[project]
|
||||
name = "openapi_client"
|
||||
version = "1.0.0"
|
||||
description = "Echo Server API"
|
||||
authors = ["OpenAPI Generator Community <team@openapitools.org>"]
|
||||
authors = [
|
||||
{name = "OpenAPI Generator Community",email = "team@openapitools.org"},
|
||||
]
|
||||
license = "Apache 2.0"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
keywords = ["OpenAPI", "OpenAPI-Generator", "Echo Server API"]
|
||||
include = ["openapi_client/py.typed"]
|
||||
requires-python = "^3.9"
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.9"
|
||||
dependencies = [
|
||||
"urllib3 (>=2.1.0,<3.0.0)",
|
||||
"python-dateutil (>=2.8.2)",
|
||||
"pydantic (>=2)",
|
||||
"typing-extensions (>=4.7.1)"
|
||||
]
|
||||
|
||||
urllib3 = ">= 2.1.0, < 3.0.0"
|
||||
python-dateutil = ">= 2.8.2"
|
||||
pydantic = ">= 2"
|
||||
typing-extensions = ">= 4.7.1"
|
||||
[project.urls]
|
||||
Repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
[tool.poetry]
|
||||
requires-poetry = ">=2.0"
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
pytest = ">= 7.2.1"
|
||||
pytest-cov = ">= 2.8.1"
|
||||
tox = ">= 3.9.0"
|
||||
|
||||
@@ -1,23 +1,29 @@
|
||||
[tool.poetry]
|
||||
[project]
|
||||
name = "openapi_client"
|
||||
version = "1.0.0"
|
||||
description = "Echo Server API"
|
||||
authors = ["OpenAPI Generator Community <team@openapitools.org>"]
|
||||
authors = [
|
||||
{name = "OpenAPI Generator Community",email = "team@openapitools.org"},
|
||||
]
|
||||
license = "Apache 2.0"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
keywords = ["OpenAPI", "OpenAPI-Generator", "Echo Server API"]
|
||||
include = ["openapi_client/py.typed"]
|
||||
requires-python = "^3.9"
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.9"
|
||||
dependencies = [
|
||||
"urllib3 (>=2.1.0,<3.0.0)",
|
||||
"python-dateutil (>=2.8.2)",
|
||||
"pydantic (>=2)",
|
||||
"typing-extensions (>=4.7.1)"
|
||||
]
|
||||
|
||||
urllib3 = ">= 2.1.0, < 3.0.0"
|
||||
python-dateutil = ">= 2.8.2"
|
||||
pydantic = ">= 2"
|
||||
typing-extensions = ">= 4.7.1"
|
||||
[project.urls]
|
||||
Repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
[tool.poetry]
|
||||
requires-poetry = ">=2.0"
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
pytest = ">= 7.2.1"
|
||||
pytest-cov = ">= 2.8.1"
|
||||
tox = ">= 3.9.0"
|
||||
|
||||
@@ -1,27 +1,33 @@
|
||||
[tool.poetry]
|
||||
[project]
|
||||
name = "petstore_api"
|
||||
version = "1.0.0"
|
||||
description = "OpenAPI Petstore"
|
||||
authors = ["OpenAPI Generator Community <team@openapitools.org>"]
|
||||
authors = [
|
||||
{name = "OpenAPI Generator Community",email = "team@openapitools.org"},
|
||||
]
|
||||
license = "Apache-2.0"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
keywords = ["OpenAPI", "OpenAPI-Generator", "OpenAPI Petstore"]
|
||||
include = ["petstore_api/py.typed"]
|
||||
requires-python = "^3.9"
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.9"
|
||||
dependencies = [
|
||||
"urllib3 (>=2.1.0,<3.0.0)",
|
||||
"python-dateutil (>=2.8.2)",
|
||||
"aiohttp (>=3.8.4)",
|
||||
"aiohttp-retry (>=2.8.3)",
|
||||
"pem (>=19.3.0)",
|
||||
"pycryptodome (>=3.9.0)",
|
||||
"pydantic (>=2)",
|
||||
"typing-extensions (>=4.7.1)"
|
||||
]
|
||||
|
||||
urllib3 = ">= 2.1.0, < 3.0.0"
|
||||
python-dateutil = ">= 2.8.2"
|
||||
aiohttp = ">= 3.8.4"
|
||||
aiohttp-retry = ">= 2.8.3"
|
||||
pem = ">= 19.3.0"
|
||||
pycryptodome = ">= 3.9.0"
|
||||
pydantic = ">= 2"
|
||||
typing-extensions = ">= 4.7.1"
|
||||
[project.urls]
|
||||
Repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
[tool.poetry]
|
||||
requires-poetry = ">=2.0"
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
pytest = ">= 7.2.1"
|
||||
pytest-cov = ">= 2.8.1"
|
||||
tox = ">= 3.9.0"
|
||||
|
||||
@@ -1,25 +1,31 @@
|
||||
[tool.poetry]
|
||||
[project]
|
||||
name = "petstore_api"
|
||||
version = "1.0.0"
|
||||
description = "OpenAPI Petstore"
|
||||
authors = ["OpenAPI Generator Community <team@openapitools.org>"]
|
||||
authors = [
|
||||
{name = "OpenAPI Generator Community",email = "team@openapitools.org"},
|
||||
]
|
||||
license = "Apache-2.0"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
keywords = ["OpenAPI", "OpenAPI-Generator", "OpenAPI Petstore"]
|
||||
include = ["petstore_api/py.typed"]
|
||||
requires-python = "^3.9"
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.9"
|
||||
dependencies = [
|
||||
"urllib3 (>=2.1.0,<3.0.0)",
|
||||
"python-dateutil (>=2.8.2)",
|
||||
"pem (>=19.3.0)",
|
||||
"pycryptodome (>=3.9.0)",
|
||||
"pydantic (>=2)",
|
||||
"typing-extensions (>=4.7.1)"
|
||||
]
|
||||
|
||||
urllib3 = ">= 2.1.0, < 3.0.0"
|
||||
python-dateutil = ">= 2.8.2"
|
||||
pem = ">= 19.3.0"
|
||||
pycryptodome = ">= 3.9.0"
|
||||
pydantic = ">= 2"
|
||||
typing-extensions = ">= 4.7.1"
|
||||
[project.urls]
|
||||
Repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
[tool.poetry]
|
||||
requires-poetry = ">=2.0"
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
pytest = ">= 7.2.1"
|
||||
pytest-cov = ">= 2.8.1"
|
||||
tox = ">= 3.9.0"
|
||||
|
||||
Reference in New Issue
Block a user