Skip to content

Commit 576bcd3

Browse files
committed
[python] Migrate from flake8 to ruff
This has the advantage of being able to automatically format the generated code for us as well as validating it. It also allows us to remove the setup.cfg file. Signed-off-by: Stephen Finucane <stephen@that.guru>
1 parent 283e4a6 commit 576bcd3

File tree

18 files changed

+15
-36
lines changed

18 files changed

+15
-36
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,6 @@ public void processOpts() {
286286
supportingFiles.add(new SupportingFile("tox.mustache", "", "tox.ini"));
287287
supportingFiles.add(new SupportingFile("test-requirements.mustache", "", "test-requirements.txt"));
288288
supportingFiles.add(new SupportingFile("requirements.mustache", "", "requirements.txt"));
289-
supportingFiles.add(new SupportingFile("setup_cfg.mustache", "", "setup.cfg"));
290289

291290
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
292291
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# coding: utf-8
2-
31
# flake8: noqa
42
{{>partial_header}}
53

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
# coding: utf-8
2-
31
# flake8: noqa
42

53
{{>partial_header}}
64

7-
85
__version__ = "{{packageVersion}}"
96

107
# Define package exports

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,16 @@ Repository = "https://{{{gitHost}}}/{{{gitUserId}}}/{{{gitRepoId}}}"
4747
[tool.poetry.group.dev.dependencies]
4848
pytest = ">= 7.2.1"
4949
pytest-cov = ">= 2.8.1"
50-
tox = ">= 3.9.0"
51-
flake8 = ">= 4.0.0"
50+
ruff = ">= 0.14.0"
5251
types-python-dateutil = ">= 2.8.19.14"
5352
mypy = ">= 1.5"
5453

5554
[tool.pylint.'MESSAGES CONTROL']
5655
extension-pkg-whitelist = "pydantic"
5756

57+
[tool.ruff.lint]
58+
select = ["E4", "E5", "E7", "E9", "F"]
59+
5860
[tool.mypy]
5961
files = [
6062
"{{{packageName}}}",

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

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
pytest >= 7.2.1
22
pytest-cov >= 2.8.1
3-
tox >= 3.9.0
4-
flake8 >= 4.0.0
3+
ruff >= 0.14.0
54
types-python-dateutil >= 2.8.19.14
65
mypy >= 1.5

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ openapi_client/py.typed
5151
openapi_client/rest.py
5252
pyproject.toml
5353
requirements.txt
54-
setup.cfg
5554
test-requirements.txt
5655
test/__init__.py
5756
test/test_auth_api.py

samples/client/echo_api/python/openapi_client/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# coding: utf-8
2-
31
# flake8: noqa
42

53
"""
@@ -14,7 +12,6 @@
1412
Do not edit the class manually.
1513
""" # noqa: E501
1614

17-
1815
__version__ = "1.0.0"
1916

2017
# Define package exports

samples/client/echo_api/python/openapi_client/models/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# coding: utf-8
2-
31
# flake8: noqa
42
"""
53
Echo Server API

samples/client/echo_api/python/pyproject.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@ Repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID"
2626
[tool.poetry.group.dev.dependencies]
2727
pytest = ">= 7.2.1"
2828
pytest-cov = ">= 2.8.1"
29-
tox = ">= 3.9.0"
30-
flake8 = ">= 4.0.0"
29+
ruff = ">= 0.14.0"
3130
types-python-dateutil = ">= 2.8.19.14"
3231
mypy = ">= 1.5"
3332

3433
[tool.pylint.'MESSAGES CONTROL']
3534
extension-pkg-whitelist = "pydantic"
3635

36+
[tool.ruff.lint]
37+
select = ["E4", "E5", "E7", "E9", "F"]
38+
3739
[tool.mypy]
3840
files = [
3941
"openapi_client",

0 commit comments

Comments
 (0)