Skip to content

Commit da33f86

Browse files
committed
[python] Remove setup.py file
We now use poetry so a setuptools setup.py file is unnecessary. The READMEs are also updated to reflect this. Signed-off-by: Stephen Finucane <stephen@that.guru>
1 parent 0c18733 commit da33f86

23 files changed

Lines changed: 26 additions & 513 deletions

File tree

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public PythonClientCodegen() {
133133
cliOptions.clear();
134134
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, "python package name (convention: snake_case).")
135135
.defaultValue("openapi_client"));
136-
cliOptions.add(new CliOption(CodegenConstants.PROJECT_NAME, "python project name in setup.py (e.g. petstore-api)."));
136+
cliOptions.add(new CliOption(CodegenConstants.PROJECT_NAME, "python project name in pyproject.toml (e.g. petstore-api)."));
137137
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_VERSION, "python package version.")
138138
.defaultValue("1.0.0"));
139139
cliOptions.add(new CliOption(PACKAGE_URL, "python package URL."));
@@ -293,7 +293,6 @@ public void processOpts() {
293293
supportingFiles.add(new SupportingFile("travis.mustache", "", ".travis.yml"));
294294
supportingFiles.add(new SupportingFile("github-workflow.mustache", ".github/workflows", "python.yml"));
295295
supportingFiles.add(new SupportingFile("gitlab-ci.mustache", "", ".gitlab-ci.yml"));
296-
supportingFiles.add(new SupportingFile("setup.mustache", "", "setup.py"));
297296
supportingFiles.add(new SupportingFile("pyproject.mustache", "", "pyproject.toml"));
298297
supportingFiles.add(new SupportingFile("py.typed.mustache", packagePath(), "py.typed"));
299298
}

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

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,39 +12,25 @@ This Python package is automatically generated by the [OpenAPI Generator](https:
1212
{{/hideGenerationTimestamp}}
1313
- Generator version: {{generatorVersion}}
1414
- Build package: {{generatorClass}}
15+
1516
{{#infoUrl}}
1617
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
1718
{{/infoUrl}}
1819

19-
## Requirements.
20+
## Requirements
2021

2122
Python {{{generatorLanguageVersion}}}
2223

2324
## Installation & Usage
24-
### pip install
2525

2626
If the python package is hosted on a repository, you can install directly using:
2727

2828
```sh
2929
pip install git+https://{{gitHost}}/{{{gitUserId}}}/{{{gitRepoId}}}.git
3030
```
31-
(you may need to run `pip` with root permission: `sudo pip install git+https://{{gitHost}}/{{{gitUserId}}}/{{{gitRepoId}}}.git`)
32-
33-
Then import the package:
34-
```python
35-
import {{{packageName}}}
36-
```
3731

38-
### Setuptools
32+
Once installed, import the package:
3933

40-
Install via [Setuptools](http://pypi.python.org/pypi/setuptools).
41-
42-
```sh
43-
python setup.py install --user
44-
```
45-
(or `sudo python setup.py install` to install the package for all users)
46-
47-
Then import the package:
4834
```python
4935
import {{{packageName}}}
5036
```
@@ -58,4 +44,3 @@ Execute `pytest` to run the tests.
5844
Please follow the [installation procedure](#installation--usage) and then run the following:
5945

6046
{{> common_README }}
61-

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@ The `{{packageName}}` package is automatically generated by the [OpenAPI Generat
1616
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
1717
{{/infoUrl}}
1818

19-
## Requirements.
19+
## Requirements
2020

2121
Python {{{generatorLanguageVersion}}}
2222

2323
## Installation & Usage
2424

25-
This python library package is generated without supporting files like setup.py or requirements files
26-
25+
This python library package is generated without supporting files like `pyproject.toml`.
2726
To be able to use it, you will need these dependencies in your own package that uses this library:
2827

2928
* urllib3 >= 2.1.0, < 3.0.0
@@ -48,4 +47,3 @@ In your own code, to use this library to connect and interact with {{{projectNam
4847
you can run the following:
4948

5049
{{> common_README }}
51-

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

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

modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientCodegenTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -564,9 +564,8 @@ public void testHandleNoApis() throws IOException {
564564
File apiFile = files.get(Paths.get(output.getAbsolutePath(), "openapi_client", "api", "hello_example_api.py").toString());
565565
assertNull(apiFile);
566566

567-
File setupFile = files.get(Paths.get(output.getAbsolutePath(), "setup.py").toString());
568-
assertNotNull(setupFile);
569-
assertFileContains(setupFile.toPath(), "setup(");
567+
File pyprojectTOMLFile = files.get(Paths.get(output.getAbsolutePath(), "pyproject.toml").toString());
568+
assertNotNull(pyprojectTOMLFile);
570569
}
571570

572571
@Test(description = "outputs __init__.py with imports for exports")

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ openapi_client/rest.py
5252
pyproject.toml
5353
requirements.txt
5454
setup.cfg
55-
setup.py
5655
test-requirements.txt
5756
test/__init__.py
5857
tox.ini

samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/README.md

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,21 @@ This Python package is automatically generated by the [OpenAPI Generator](https:
88
- Generator version: 7.19.0-SNAPSHOT
99
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
1010

11-
## Requirements.
11+
12+
## Requirements
1213

1314
Python 3.9+
1415

1516
## Installation & Usage
16-
### pip install
1717

1818
If the python package is hosted on a repository, you can install directly using:
1919

2020
```sh
2121
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
2222
```
23-
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`)
24-
25-
Then import the package:
26-
```python
27-
import openapi_client
28-
```
2923

30-
### Setuptools
24+
Once installed, import the package:
3125

32-
Install via [Setuptools](http://pypi.python.org/pypi/setuptools).
33-
34-
```sh
35-
python setup.py install --user
36-
```
37-
(or `sudo python setup.py install` to install the package for all users)
38-
39-
Then import the package:
4026
```python
4127
import openapi_client
4228
```
@@ -160,4 +146,3 @@ Authentication schemes defined for the API:
160146

161147
team@openapitools.org
162148

163-

samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/setup.py

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

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ openapi_client/rest.py
5252
pyproject.toml
5353
requirements.txt
5454
setup.cfg
55-
setup.py
5655
test-requirements.txt
5756
test/__init__.py
5857
tox.ini

samples/client/echo_api/python/README.md

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,21 @@ This Python package is automatically generated by the [OpenAPI Generator](https:
88
- Generator version: 7.19.0-SNAPSHOT
99
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
1010

11-
## Requirements.
11+
12+
## Requirements
1213

1314
Python 3.9+
1415

1516
## Installation & Usage
16-
### pip install
1717

1818
If the python package is hosted on a repository, you can install directly using:
1919

2020
```sh
2121
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
2222
```
23-
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`)
24-
25-
Then import the package:
26-
```python
27-
import openapi_client
28-
```
2923

30-
### Setuptools
24+
Once installed, import the package:
3125

32-
Install via [Setuptools](http://pypi.python.org/pypi/setuptools).
33-
34-
```sh
35-
python setup.py install --user
36-
```
37-
(or `sudo python setup.py install` to install the package for all users)
38-
39-
Then import the package:
4026
```python
4127
import openapi_client
4228
```
@@ -160,4 +146,3 @@ Authentication schemes defined for the API:
160146

161147
team@openapitools.org
162148

163-

0 commit comments

Comments
 (0)