From 087fb0ee76a5c60084e75da26a3c02d61c7c3115 Mon Sep 17 00:00:00 2001 From: Sascha Kreutz Date: Wed, 26 Nov 2025 11:21:57 +0100 Subject: [PATCH 1/3] fix: do not add dependency on urllib3 if not required --- .../src/main/resources/python/pyproject.mustache | 4 ++++ .../src/main/resources/python/requirements.mustache | 2 ++ .../src/main/resources/python/setup.mustache | 2 ++ 3 files changed, 8 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/python/pyproject.mustache b/modules/openapi-generator/src/main/resources/python/pyproject.mustache index 6cd7936be558..7eed997a3f43 100644 --- a/modules/openapi-generator/src/main/resources/python/pyproject.mustache +++ b/modules/openapi-generator/src/main/resources/python/pyproject.mustache @@ -33,7 +33,9 @@ include = ["{{packageName}}/py.typed"] [tool.poetry.dependencies] python = "^3.9" +{{^async}} urllib3 = ">= 2.1.0, < 3.0.0" +{{/async}} python-dateutil = ">= 2.8.2" {{#asyncio}} aiohttp = ">= 3.8.4" @@ -59,7 +61,9 @@ lazy-imports = ">= 1, < 2" requires-python = ">=3.9" dependencies = [ +{{^async}} "urllib3 (>=2.1.0,<3.0.0)", +{{/async}} "python-dateutil (>=2.8.2)", {{#httpx}} "httpx (>=0.28.1)", diff --git a/modules/openapi-generator/src/main/resources/python/requirements.mustache b/modules/openapi-generator/src/main/resources/python/requirements.mustache index ee103eba2d74..aef16e4cb7ad 100644 --- a/modules/openapi-generator/src/main/resources/python/requirements.mustache +++ b/modules/openapi-generator/src/main/resources/python/requirements.mustache @@ -1,4 +1,6 @@ +{{^async}} urllib3 >= 2.1.0, < 3.0.0 +{{/async}} python_dateutil >= 2.8.2 {{#asyncio}} aiohttp >= 3.8.4 diff --git a/modules/openapi-generator/src/main/resources/python/setup.mustache b/modules/openapi-generator/src/main/resources/python/setup.mustache index b4589687b173..d65485b42f90 100644 --- a/modules/openapi-generator/src/main/resources/python/setup.mustache +++ b/modules/openapi-generator/src/main/resources/python/setup.mustache @@ -15,7 +15,9 @@ NAME = "{{{projectName}}}" VERSION = "{{packageVersion}}" PYTHON_REQUIRES = ">= 3.9" REQUIRES = [ +{{^async}} "urllib3 >= 2.1.0, < 3.0.0", +{{/async}} "python-dateutil >= 2.8.2", {{#asyncio}} "aiohttp >= 3.8.4", From c452e606e417611448b109ab9e9f601182cc88e6 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 27 Nov 2025 14:49:49 +0800 Subject: [PATCH 2/3] update samples --- samples/openapi3/client/petstore/python-aiohttp/pyproject.toml | 1 - samples/openapi3/client/petstore/python-aiohttp/requirements.txt | 1 - samples/openapi3/client/petstore/python-aiohttp/setup.py | 1 - samples/openapi3/client/petstore/python-httpx/pyproject.toml | 1 - samples/openapi3/client/petstore/python-httpx/requirements.txt | 1 - samples/openapi3/client/petstore/python-httpx/setup.py | 1 - 6 files changed, 6 deletions(-) diff --git a/samples/openapi3/client/petstore/python-aiohttp/pyproject.toml b/samples/openapi3/client/petstore/python-aiohttp/pyproject.toml index fbafbe1e07a2..8e03a6c82feb 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/pyproject.toml +++ b/samples/openapi3/client/petstore/python-aiohttp/pyproject.toml @@ -11,7 +11,6 @@ include = ["petstore_api/py.typed"] [tool.poetry.dependencies] python = "^3.9" -urllib3 = ">= 2.1.0, < 3.0.0" python-dateutil = ">= 2.8.2" aiohttp = ">= 3.8.4" aiohttp-retry = ">= 2.8.3" diff --git a/samples/openapi3/client/petstore/python-aiohttp/requirements.txt b/samples/openapi3/client/petstore/python-aiohttp/requirements.txt index 76b1f7272d19..add57040b437 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/requirements.txt +++ b/samples/openapi3/client/petstore/python-aiohttp/requirements.txt @@ -1,4 +1,3 @@ -urllib3 >= 2.1.0, < 3.0.0 python_dateutil >= 2.8.2 aiohttp >= 3.8.4 aiohttp-retry >= 2.8.3 diff --git a/samples/openapi3/client/petstore/python-aiohttp/setup.py b/samples/openapi3/client/petstore/python-aiohttp/setup.py index eab7be21eea2..93a557bdcaa9 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/setup.py +++ b/samples/openapi3/client/petstore/python-aiohttp/setup.py @@ -24,7 +24,6 @@ VERSION = "1.0.0" PYTHON_REQUIRES = ">= 3.9" REQUIRES = [ - "urllib3 >= 2.1.0, < 3.0.0", "python-dateutil >= 2.8.2", "aiohttp >= 3.8.4", "aiohttp-retry >= 2.8.3", diff --git a/samples/openapi3/client/petstore/python-httpx/pyproject.toml b/samples/openapi3/client/petstore/python-httpx/pyproject.toml index 6ed9055b00f6..17720c14e8c2 100644 --- a/samples/openapi3/client/petstore/python-httpx/pyproject.toml +++ b/samples/openapi3/client/petstore/python-httpx/pyproject.toml @@ -11,7 +11,6 @@ keywords = ["OpenAPI", "OpenAPI-Generator", "OpenAPI Petstore"] requires-python = ">=3.9" dependencies = [ - "urllib3 (>=2.1.0,<3.0.0)", "python-dateutil (>=2.8.2)", "httpx (>=0.28.1)", "pem (>=19.3.0)", diff --git a/samples/openapi3/client/petstore/python-httpx/requirements.txt b/samples/openapi3/client/petstore/python-httpx/requirements.txt index 373d131abd07..47ae4aa20eac 100644 --- a/samples/openapi3/client/petstore/python-httpx/requirements.txt +++ b/samples/openapi3/client/petstore/python-httpx/requirements.txt @@ -1,4 +1,3 @@ -urllib3 >= 2.1.0, < 3.0.0 python_dateutil >= 2.8.2 httpx = ">= 0.28.1" pem >= 19.3.0 diff --git a/samples/openapi3/client/petstore/python-httpx/setup.py b/samples/openapi3/client/petstore/python-httpx/setup.py index 36a30666aaaa..e9883ecf3ccc 100644 --- a/samples/openapi3/client/petstore/python-httpx/setup.py +++ b/samples/openapi3/client/petstore/python-httpx/setup.py @@ -24,7 +24,6 @@ VERSION = "1.0.0" PYTHON_REQUIRES = ">= 3.9" REQUIRES = [ - "urllib3 >= 2.1.0, < 3.0.0", "python-dateutil >= 2.8.2", "httpx >= 0.28.1", "pem >= 19.3.0", From 616d837cace83312a4d01370264ec9657590ce2f Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 27 Nov 2025 15:33:07 +0800 Subject: [PATCH 3/3] remove import --- .../client/petstore/python-aiohttp/tests/test_pet_api.py | 1 - 1 file changed, 1 deletion(-) diff --git a/samples/openapi3/client/petstore/python-aiohttp/tests/test_pet_api.py b/samples/openapi3/client/petstore/python-aiohttp/tests/test_pet_api.py index ad2c397d05e1..2d4f64f4f38c 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/tests/test_pet_api.py +++ b/samples/openapi3/client/petstore/python-aiohttp/tests/test_pet_api.py @@ -24,7 +24,6 @@ import json -import urllib3 HOST = 'http://localhost:80/v2'