Skip to content

Commit ed8f1e4

Browse files
committed
Merge branch 'main' into openapi-3.1
2 parents 12467f0 + 38668c0 commit ed8f1e4

16 files changed

+195
-295
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
default: major
3+
---
4+
5+
# Switch from Black to Ruff for formatting
6+
7+
`black` is no longer a runtime dependency, so if you have them set in custom `post_hooks` in a config file, you'll need to make sure they're being installed manually. [`ruff`](https://docs.astral.sh/ruff) is now installed and used by default instead.

.github/workflows/checks.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@ jobs:
4545
- name: Install Dependencies
4646
run: poetry install
4747

48-
- name: Run Black
49-
run: poetry run black . --check
48+
- name: Check formatting
49+
run: poetry run ruff format . --check
5050

5151
- name: Run safety
5252
run: poetry export -f requirements.txt | poetry run safety check --bare --stdin
5353

5454
- name: Run mypy
5555
run: poetry run mypy --show-error-codes openapi_python_client
5656

57-
- name: Run Ruff
57+
- name: Lint
5858
run: poetry run ruff check .
5959

6060
- name: Run pytest

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
[![codecov](https://codecov.io/gh/openapi-generators/openapi-python-client/branch/main/graph/badge.svg)](https://codecov.io/gh/triaxtec/openapi-python-client)
33
[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://lbesson.mit-license.org/)
44
[![Generic badge](https://img.shields.io/badge/type_checked-mypy-informational.svg)](https://mypy.readthedocs.io/en/stable/introduction.html)
5-
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
65
[![PyPI version shields.io](https://img.shields.io/pypi/v/openapi-python-client.svg)](https://pypi.python.org/pypi/openapi-python-client/)
76
[![Downloads](https://static.pepy.tech/personalized-badge/openapi-python-client?period=total&units=international_system&left_color=blue&right_color=green&left_text=Downloads)](https://pepy.tech/project/openapi-python-client)
87

@@ -156,7 +155,7 @@ In the config file, there's an easy way to tell `openapi-python-client` to run a
156155
```yaml
157156
post_hooks:
158157
- "ruff check . --fix"
159-
- "black ."
158+
- "ruff format ."
160159
```
161160

162161
### use_path_prefixes_for_title_model_names

end_to_end_tests/golden-record/my_test_api_client/models/a_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ def _parse_not_required_one_of_models(data: object) -> Union["FreeFormModel", "M
442442
not_required_one_of_models = _parse_not_required_one_of_models(d.pop("not_required_one_of_models", UNSET))
443443

444444
def _parse_not_required_nullable_one_of_models(
445-
data: object,
445+
data: object
446446
) -> Union["FreeFormModel", "ModelWithUnionProperty", None, Unset, str]:
447447
if data is None:
448448
return data

end_to_end_tests/golden-record/my_test_api_client/models/an_array_with_a_circular_ref_in_items_object_additional_properties_a_item.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ def to_dict(self) -> Dict[str, Any]:
2727
for (
2828
componentsschemas_an_array_with_a_circular_ref_in_items_object_additional_properties_b_item_data
2929
) in prop:
30-
componentsschemas_an_array_with_a_circular_ref_in_items_object_additional_properties_b_item = (
31-
componentsschemas_an_array_with_a_circular_ref_in_items_object_additional_properties_b_item_data.to_dict()
32-
)
30+
componentsschemas_an_array_with_a_circular_ref_in_items_object_additional_properties_b_item = componentsschemas_an_array_with_a_circular_ref_in_items_object_additional_properties_b_item_data.to_dict()
3331

3432
field_dict[prop_name].append(
3533
componentsschemas_an_array_with_a_circular_ref_in_items_object_additional_properties_b_item

end_to_end_tests/golden-record/my_test_api_client/models/an_array_with_a_circular_ref_in_items_object_additional_properties_b_item.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ def to_dict(self) -> Dict[str, Any]:
2727
for (
2828
componentsschemas_an_array_with_a_circular_ref_in_items_object_additional_properties_a_item_data
2929
) in prop:
30-
componentsschemas_an_array_with_a_circular_ref_in_items_object_additional_properties_a_item = (
31-
componentsschemas_an_array_with_a_circular_ref_in_items_object_additional_properties_a_item_data.to_dict()
32-
)
30+
componentsschemas_an_array_with_a_circular_ref_in_items_object_additional_properties_a_item = componentsschemas_an_array_with_a_circular_ref_in_items_object_additional_properties_a_item_data.to_dict()
3331

3432
field_dict[prop_name].append(
3533
componentsschemas_an_array_with_a_circular_ref_in_items_object_additional_properties_a_item

end_to_end_tests/golden-record/my_test_api_client/models/an_array_with_a_recursive_ref_in_items_object_additional_properties_item.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ def to_dict(self) -> Dict[str, Any]:
1919
for prop_name, prop in self.additional_properties.items():
2020
field_dict[prop_name] = []
2121
for componentsschemas_an_array_with_a_recursive_ref_in_items_object_additional_properties_item_data in prop:
22-
componentsschemas_an_array_with_a_recursive_ref_in_items_object_additional_properties_item = (
23-
componentsschemas_an_array_with_a_recursive_ref_in_items_object_additional_properties_item_data.to_dict()
24-
)
22+
componentsschemas_an_array_with_a_recursive_ref_in_items_object_additional_properties_item = componentsschemas_an_array_with_a_recursive_ref_in_items_object_additional_properties_item_data.to_dict()
2523

2624
field_dict[prop_name].append(
2725
componentsschemas_an_array_with_a_recursive_ref_in_items_object_additional_properties_item

end_to_end_tests/golden-record/my_test_api_client/models/model_with_any_json_properties.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
5353
for prop_name, prop_dict in d.items():
5454

5555
def _parse_additional_property(
56-
data: object,
56+
data: object
5757
) -> Union["ModelWithAnyJsonPropertiesAdditionalPropertyType0", List[str], bool, float, int, str]:
5858
try:
5959
if not isinstance(data, dict):

end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
5353
d = src_dict.copy()
5454

5555
def _parse_fruit(
56-
data: object,
56+
data: object
5757
) -> Union["ModelWithUnionPropertyInlinedFruitType0", "ModelWithUnionPropertyInlinedFruitType1", Unset]:
5858
if isinstance(data, Unset):
5959
return data

end_to_end_tests/golden-record/pyproject.toml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,6 @@ python-dateutil = "^2.8.0"
2121
requires = ["poetry-core>=1.0.0"]
2222
build-backend = "poetry.core.masonry.api"
2323

24-
[tool.black]
25-
line-length = 120
26-
target_version = ['py38', 'py39', 'py310', 'py311']
27-
exclude = '''
28-
(
29-
/(
30-
| \.git
31-
| \.venv
32-
| \.mypy_cache
33-
)/
34-
)
35-
'''
36-
3724
[tool.ruff]
3825
select = ["F", "I"]
3926
line-length = 120

integration-tests/poetry.lock

Lines changed: 13 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration-tests/pyproject.toml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,6 @@ pytest-asyncio = "^0.21.0"
2626
requires = ["poetry>=1.0"]
2727
build-backend = "poetry.masonry.api"
2828

29-
[tool.black]
30-
line-length = 120
31-
target_version = ['py38', 'py39', 'py310', 'py311']
32-
exclude = '''
33-
(
34-
/(
35-
| \.git
36-
| \.venv
37-
| \.mypy_cache
38-
)/
39-
)
40-
'''
41-
4229
[tool.ruff]
4330
select = ["F", "I"]
4431
line-length = 120

openapi_python_client/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Config(BaseModel):
3030
use_path_prefixes_for_title_model_names: bool = True
3131
post_hooks: List[str] = [
3232
"ruff check --fix .",
33-
"black .",
33+
"ruff format .",
3434
]
3535
field_prefix: str = "field_"
3636
http_timeout: int = 5
Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
[tool.black]
2-
line-length = 120
3-
target_version = ['py38', 'py39', 'py310', 'py311']
4-
exclude = '''
5-
(
6-
/(
7-
| \.git
8-
| \.venv
9-
| \.mypy_cache
10-
)/
11-
)
12-
'''
13-
141
[tool.ruff]
152
select = ["F", "I"]
163
line-length = 120

0 commit comments

Comments
 (0)