Skip to content

Commit ef2dda0

Browse files
committed
[python] Stop generating requirements.txt files by default
We only need to generate these for convenience if we are not generating a pyproject.toml file. Signed-off-by: Stephen Finucane <[email protected]>
1 parent 3e1bcdc commit ef2dda0

File tree

20 files changed

+10
-95
lines changed

20 files changed

+10
-95
lines changed

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,6 @@ public void processOpts() {
284284

285285
if (!generateSourceCodeOnly) {
286286
supportingFiles.add(new SupportingFile("tox.mustache", "", "tox.ini"));
287-
supportingFiles.add(new SupportingFile("test-requirements.mustache", "", "test-requirements.txt"));
288-
supportingFiles.add(new SupportingFile("requirements.mustache", "", "requirements.txt"));
289287

290288
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
291289
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
@@ -294,6 +292,9 @@ public void processOpts() {
294292
supportingFiles.add(new SupportingFile("gitlab-ci.mustache", "", ".gitlab-ci.yml"));
295293
supportingFiles.add(new SupportingFile("pyproject.mustache", "", "pyproject.toml"));
296294
supportingFiles.add(new SupportingFile("py.typed.mustache", packagePath(), "py.typed"));
295+
} else {
296+
supportingFiles.add(new SupportingFile("requirements.mustache", "", "requirements.txt"));
297+
supportingFiles.add(new SupportingFile("test-requirements.mustache", "", "test-requirements.txt"));
297298
}
298299
supportingFiles.add(new SupportingFile("configuration.mustache", packagePath(), "configuration.py"));
299300
supportingFiles.add(new SupportingFile("__init__package.mustache", packagePath(), "__init__.py"));

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

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,13 @@ Python {{{generatorLanguageVersion}}}
2323
## Installation & Usage
2424

2525
This python library package is generated without supporting files like `pyproject.toml`.
26-
To be able to use it, you will need these dependencies in your own package that uses this library:
27-
28-
* urllib3 >= 2.1.0, < 3.0.0
29-
* python-dateutil >= 2.8.2
30-
{{#async}}
31-
* aiohttp >= 3.8.4
32-
* aiohttp-retry >= 2.8.3
33-
{{/async}}
34-
{{#tornado}}
35-
* tornado >= 4.2, < 5
36-
{{/tornado}}
37-
{{#hasHttpSignatureMethods}}
38-
* pem >= 19.3.0
39-
* pycryptodome >= 3.9.0
40-
{{/hasHttpSignatureMethods}}
41-
* pydantic >= 2
42-
* typing-extensions >= 4.7.1
26+
To be able to use it, you will need these dependencies in your own package that uses this library.
27+
Requirements files (`requirement.txt`, `test-requirements.txt`) are provided for this.
28+
29+
```
30+
pip install -r requirements.txt # install runtime dependencies
31+
pip install -r test-requirements.txt # (optional) install testing dependencies
32+
```
4333

4434
## Getting Started
4535

samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/.openapi-generator/FILES

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,5 @@ openapi_client/models/test_query_style_form_explode_true_array_string_query_obje
5050
openapi_client/py.typed
5151
openapi_client/rest.py
5252
pyproject.toml
53-
requirements.txt
54-
test-requirements.txt
5553
test/__init__.py
5654
tox.ini

samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/requirements.txt

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

samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test-requirements.txt

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

samples/client/echo_api/python/.openapi-generator/FILES

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,5 @@ openapi_client/models/test_query_style_form_explode_true_array_string_query_obje
5050
openapi_client/py.typed
5151
openapi_client/rest.py
5252
pyproject.toml
53-
requirements.txt
54-
test-requirements.txt
5553
test/__init__.py
5654
tox.ini

samples/client/echo_api/python/requirements.txt

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

samples/client/echo_api/python/test-requirements.txt

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

samples/openapi3/client/petstore/python-aiohttp/.openapi-generator/FILES

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,5 @@ petstore_api/py.typed
255255
petstore_api/rest.py
256256
petstore_api/signing.py
257257
pyproject.toml
258-
requirements.txt
259-
test-requirements.txt
260258
test/__init__.py
261259
tox.ini

samples/openapi3/client/petstore/python-aiohttp/requirements.txt

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

0 commit comments

Comments
 (0)